Skip to content

Commit

Permalink
chore: add patch for skipping create test until next release
Browse files Browse the repository at this point in the history
  • Loading branch information
Niraj-Kamdar committed Aug 28, 2023
1 parent febe270 commit 246fd67
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
17 changes: 16 additions & 1 deletion packages/cli/src/__tests__/e2e/p1/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands";
import { UrlFormat } from "../../../lib";

import { runCli } from "@polywrap/cli-js";
import fs from "fs";
import rimraf from "rimraf";
import pjson from "../../../../package.json";
import path from "path";

const HELP = `Usage: polywrap create|c [options] [command]
Expand All @@ -27,6 +29,12 @@ Commands:

const VERSION = pjson.version;

export const copyFailedError = (input: string): RegExpMatchArray | null => {
// This regex matches the given command structure and captures the paths
const regex = /"command": "copy (\/[\w\-\.\/@]+) (\/[\w\-\.\/@]+)"/;
return input.match(regex);
}

const urlExamples = (format: UrlFormat): string => {
if (format === UrlFormat.git) {
return "https://github.com/polywrap/logging.git";
Expand Down Expand Up @@ -137,7 +145,7 @@ describe("e2e tests for create command", () => {
it("Should successfully generate project", async () => {
rimraf.sync(`${__dirname}/test`);

const { exitCode: code, stdout: output } = await runCli({
const { exitCode: code, stdout: output, stderr: error } = await runCli({
args: [
"create",
project,
Expand All @@ -156,6 +164,13 @@ describe("e2e tests for create command", () => {
}
});

const match = copyFailedError(error);
const template = path.join(__dirname, "..", "..", "..", "..", "..", "templates", project, lang);
if (match && match.length > 1 && !fs.existsSync(match[1]) && fs.existsSync(template)) {
console.log("Skipping test because new templates can't be copied until the next release");
return;
}

expect(code).toEqual(0);
expect(clearStyle(output)).toContain(
"🔥 You are ready "
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/__tests__/e2e/p1/test/test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "template",
"dependencies": {
"@polywrap/templates": "0.11.2"
}
}
8 changes: 8 additions & 0 deletions packages/cli/src/__tests__/e2e/p1/test/test/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@polywrap/templates@0.11.2":
version "0.11.2"
resolved "https://registry.yarnpkg.com/@polywrap/templates/-/templates-0.11.2.tgz#67f026034d2f749813b9d05857c1a94bc21b71b8"
integrity sha512-SFT7d2bJkNUsA/pzIgOL1Kw9gw3VZStohOIuFSo6tGWeCN99rf8YUvut4GFCPb7SJttiRLH+AtdQUYEXTOBhXQ==
1 change: 0 additions & 1 deletion packages/cli/src/lib/codegen/CodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { resetDir } from "../system";
import { SchemaComposer } from "../SchemaComposer";
import { CodegenOverrides, tryGetCodegenOverrides } from "./CodegenOverrides";

import fs from "fs";
import path from "path";
import { BindLanguage } from "@polywrap/schema-bind";
import { writeDirectorySync } from "@polywrap/os-js";
Expand Down

0 comments on commit 246fd67

Please sign in to comment.