From bf10155c3e7fdb95545bf275ddc7d6fb89729fb2 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 22 Mar 2022 10:53:13 -0400 Subject: [PATCH 1/2] [chore] Add windows to CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ee3e94..199ad5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] node: [12] runs-on: ${{ matrix.os }} steps: From 0f985a26afdb0a3d28f601f75e34647fb15073a9 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 22 Mar 2022 19:37:53 -0400 Subject: [PATCH 2/2] Fix tests on windows --- jest.config.js | 2 +- test/project.test.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/jest.config.js b/jest.config.js index a6e9c1c..ad40d19 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,5 +2,5 @@ module.exports = { collectCoverageFrom: ["src/**/*.js"], coverageReporters: ["html", "lcov"], testEnvironment: "node", - testMatch: ["/test/?(*.)+(spec|test).js?(x)"] + testMatch: ["/test/*(*.)+(spec|test).js?(x)"] }; diff --git a/test/project.test.js b/test/project.test.js index 063ba00..d3f57bc 100644 --- a/test/project.test.js +++ b/test/project.test.js @@ -1,16 +1,18 @@ const fs = require("fs"); -const child_process = require("child_process"); +const { join } = require("path"); +const { execSync } = require("child_process"); for (const project of fs.readdirSync(__dirname).filter(name => name.startsWith("project-"))) { - it(`should correctly run webpack build ${project}`, async () => { - const stdout = child_process.execSync(__dirname + "/../node_modules/.bin/webpack -c webpack.config.js", { - cwd: __dirname + "/" + project - }); + it(`should correctly run webpack build ${project}`, async () => { + const webpack = join(__dirname, '..', 'node_modules', '.bin', 'webpack'); + const cwd = join(__dirname, project); + const command = `${webpack} -c webpack.config.js`; + const stdout = execSync(command, { cwd }); const output = stdout.toString().split("\n"); ((output, __dirname) => { output; - eval(fs.readFileSync(__dirname + "/expected.js").toString()); - })(output, __dirname + "/" + project); + eval(fs.readFileSync(join(__dirname, 'expected.js')).toString()); + })(output, cwd); }); }