test: cross platform
test: add osx and windows to test platforms in travis
This commit is contained in:
parent
15683cb1d1
commit
aadf13c5a8
4 changed files with 65 additions and 11 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
language: node_js
|
language: node_js
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
- windows
|
||||||
node_js:
|
node_js:
|
||||||
- node
|
- node
|
||||||
- lts/*
|
- lts/*
|
||||||
- 14
|
|
||||||
- 13
|
|
||||||
- 12
|
- 12
|
||||||
- 11
|
|
||||||
- 10
|
- 10
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
import { promises as fs } from "fs";
|
import { promises as fs } from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import { runCommand, WEBSNACKS_BIN_PATH, WEBSNACKS_REPO_ROOT, withTempDir } from "../helpers/e2e";
|
import {
|
||||||
|
npmCmd, runCommand, WEBSNACKS_BIN_PATH, WEBSNACKS_REPO_ROOT, withTempDir
|
||||||
|
} from "../helpers/e2e";
|
||||||
import { testSuite } from "../lib";
|
import { testSuite } from "../lib";
|
||||||
|
|
||||||
testSuite("build command", ({ test }) => {
|
testSuite("build command", ({ test }) => {
|
||||||
|
|
@ -38,7 +40,7 @@ testSuite("build command", ({ test }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(tempDirPath, "websnacks.ts"),
|
path.join(tempDirPath, "websnacks.ts"),
|
||||||
`
|
`
|
||||||
import { Config } from "${WEBSNACKS_REPO_ROOT}";
|
import { Config } from "websnacks";
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
watch: [],
|
watch: [],
|
||||||
};
|
};
|
||||||
|
|
@ -53,13 +55,25 @@ testSuite("build command", ({ test }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(pagesPath, "index.tsx"),
|
path.join(pagesPath, "index.tsx"),
|
||||||
`
|
`
|
||||||
import { createElement } from "${WEBSNACKS_REPO_ROOT}";
|
import { createElement } from "websnacks";
|
||||||
export const page = () => <html />;
|
export const page = () => <html />;
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
await fs.writeFile(
|
||||||
|
path.join(tempDirPath, "package.json"),
|
||||||
|
JSON.stringify({
|
||||||
|
devDependencies: {
|
||||||
|
websnacks: `file:${WEBSNACKS_REPO_ROOT}`,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{ encoding: "utf8" }
|
||||||
|
);
|
||||||
|
await runCommand(npmCmd, ["install", "--silent"], {
|
||||||
|
cwd: tempDirPath,
|
||||||
|
}).complete;
|
||||||
const cmd = runCommand(
|
const cmd = runCommand(
|
||||||
"node",
|
"node",
|
||||||
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "build"],
|
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "build"],
|
||||||
|
|
@ -101,13 +115,25 @@ testSuite("build command", ({ test }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(pagesPath, "index.tsx"),
|
path.join(pagesPath, "index.tsx"),
|
||||||
`
|
`
|
||||||
import { createElement } from "${WEBSNACKS_REPO_ROOT}";
|
import { createElement } from "websnacks";
|
||||||
export const page = () => <html />;
|
export const page = () => <html />;
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
await fs.writeFile(
|
||||||
|
path.join(tempDirPath, "package.json"),
|
||||||
|
JSON.stringify({
|
||||||
|
devDependencies: {
|
||||||
|
websnacks: `file:${WEBSNACKS_REPO_ROOT}`,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{ encoding: "utf8" }
|
||||||
|
);
|
||||||
|
await runCommand(npmCmd, ["install", "--silent"], {
|
||||||
|
cwd: tempDirPath,
|
||||||
|
}).complete;
|
||||||
const cmd = runCommand(
|
const cmd = runCommand(
|
||||||
"node",
|
"node",
|
||||||
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "build"],
|
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "build"],
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { promises as fs } from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
runCommand, wait, WEBSNACKS_BIN_PATH, WEBSNACKS_REPO_ROOT, withTempDir
|
npmCmd, runCommand, wait, WEBSNACKS_BIN_PATH, WEBSNACKS_REPO_ROOT, withTempDir
|
||||||
} from "../helpers/e2e";
|
} from "../helpers/e2e";
|
||||||
import { testSuite } from "../lib";
|
import { testSuite } from "../lib";
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ testSuite("dev command", ({ test, expect }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(tempDirPath, "websnacks.ts"),
|
path.join(tempDirPath, "websnacks.ts"),
|
||||||
`
|
`
|
||||||
import { Config } from "${WEBSNACKS_REPO_ROOT}";
|
import { Config } from "websnacks";
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
watch: [],
|
watch: [],
|
||||||
};
|
};
|
||||||
|
|
@ -55,13 +55,25 @@ testSuite("dev command", ({ test, expect }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(pagesPath, "index.tsx"),
|
path.join(pagesPath, "index.tsx"),
|
||||||
`
|
`
|
||||||
import { createElement } from "${WEBSNACKS_REPO_ROOT}";
|
import { createElement } from "websnacks";
|
||||||
export const page = () => <html />;
|
export const page = () => <html />;
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
await fs.writeFile(
|
||||||
|
path.join(tempDirPath, "package.json"),
|
||||||
|
JSON.stringify({
|
||||||
|
devDependencies: {
|
||||||
|
websnacks: `file:${WEBSNACKS_REPO_ROOT}`,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{ encoding: "utf8" }
|
||||||
|
);
|
||||||
|
await runCommand(npmCmd, ["install", "--silent"], {
|
||||||
|
cwd: tempDirPath,
|
||||||
|
}).complete;
|
||||||
const cmd = runCommand(
|
const cmd = runCommand(
|
||||||
"node",
|
"node",
|
||||||
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "dev"],
|
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "dev"],
|
||||||
|
|
@ -107,13 +119,25 @@ testSuite("dev command", ({ test, expect }) => {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(pagesPath, "index.tsx"),
|
path.join(pagesPath, "index.tsx"),
|
||||||
`
|
`
|
||||||
import { createElement } from "${WEBSNACKS_REPO_ROOT}";
|
import { createElement } from "websnacks";
|
||||||
export const page = () => <html />;
|
export const page = () => <html />;
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
await fs.writeFile(
|
||||||
|
path.join(tempDirPath, "package.json"),
|
||||||
|
JSON.stringify({
|
||||||
|
devDependencies: {
|
||||||
|
websnacks: `file:${WEBSNACKS_REPO_ROOT}`,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{ encoding: "utf8" }
|
||||||
|
);
|
||||||
|
await runCommand(npmCmd, ["install", "--silent"], {
|
||||||
|
cwd: tempDirPath,
|
||||||
|
}).complete;
|
||||||
const cmd = runCommand(
|
const cmd = runCommand(
|
||||||
"node",
|
"node",
|
||||||
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "dev"],
|
[WEBSNACKS_BIN_PATH, "-r", "ts-node/register", "dev"],
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import { ChildProcess, spawn } from "child_process";
|
import { ChildProcess, spawn } from "child_process";
|
||||||
import { promises as fs } from "fs";
|
import { promises as fs } from "fs";
|
||||||
|
import * as os from "os";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -165,3 +166,5 @@ export const runCommand = (
|
||||||
process,
|
process,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const npmCmd = os.platform() === "win32" ? "npm.cmd" : "npm";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue