Skip to content

Commit 1317b9e

Browse files
authored
fix(tests): Allow tests to run on Windows without WSL (#3813)
A few changes to make the test suite fully cross platform
1 parent 5bba9b4 commit 1317b9e

File tree

7 files changed

+44
-31
lines changed

7 files changed

+44
-31
lines changed

packages/ember/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"lint:hbs": "ember-template-lint .",
2424
"lint:js": "eslint . --cache --cache-location '../../eslintcache/'",
2525
"start": "ember serve",
26-
"test": "bash ./scripts/run_tests.sh",
26+
"test": "node ./scripts/run_tests.js",
2727
"test:ember": "ember test",
2828
"test:ember-compatibility": "ember try:each",
2929
"prepublishOnly": "ember ts:precompile",

packages/ember/scripts/run_tests.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// running compatibilty tests takes ~15 min on a 2019 2.6 GHz 6-Core Intel i7 16" MacBook Pro w 32 GB of RAM, vs ~25 sec
2+
// for the regular tests
3+
4+
/*eslint-env node*/
5+
const { spawnSync } = require('child_process');
6+
7+
if (process.env.TRAVIS || process.env.GITHUB_ACTIONS) {
8+
console.log('In CI - running tests against multiple versions of Ember');
9+
const result = spawnSync('yarn npm-run-all lint:* test:*', { shell: true, stdio: 'inherit' });
10+
process.exit(result.status);
11+
} else {
12+
console.log('Tests running locally - will only run tests against default version of Ember');
13+
const result = spawnSync('yarn npm-run-all lint:* test:ember', { shell: true, stdio: 'inherit' });
14+
process.exit(result.status);
15+
}

packages/ember/scripts/run_tests.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/node/test/manual/release-health/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for (const dir of scenariosDirs) {
2929

3030
const processes = scenarios.map(([filename, filepath]) => {
3131
return new Promise(resolve => {
32-
const scenarioProcess = spawn('/usr/bin/env', ['node', filepath]);
32+
const scenarioProcess = spawn('node', [filepath]);
3333
const output = [];
3434
const errors = [];
3535

packages/node/test/utils.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ import { deepReadDirSync } from '../src/utils';
88

99
describe('deepReadDirSync', () => {
1010
it('handles nested files', () => {
11+
const expected = [
12+
// root level
13+
'debra.txt',
14+
// one level deep
15+
'cats/eddy.txt',
16+
'cats/persephone.txt',
17+
'cats/piper.txt',
18+
'cats/sassafras.txt',
19+
'cats/teaberry.txt',
20+
// two levels deep
21+
'dogs/theBigs/charlie.txt',
22+
'dogs/theBigs/maisey.txt',
23+
'dogs/theSmalls/bodhi.txt',
24+
'dogs/theSmalls/cory.txt',
25+
].map(p => (process.platform === 'win32' ? p.replace(/\//g, '\\') : p));
26+
1127
// compare sets so that order doesn't matter
12-
expect(new Set(deepReadDirSync('./test/fixtures/testDeepReadDirSync'))).toEqual(
13-
new Set([
14-
// root level
15-
'debra.txt',
16-
// one level deep
17-
'cats/eddy.txt',
18-
'cats/persephone.txt',
19-
'cats/piper.txt',
20-
'cats/sassafras.txt',
21-
'cats/teaberry.txt',
22-
// two levels deep
23-
'dogs/theBigs/charlie.txt',
24-
'dogs/theBigs/maisey.txt',
25-
'dogs/theSmalls/bodhi.txt',
26-
'dogs/theSmalls/cory.txt',
27-
]),
28-
);
28+
expect(new Set(deepReadDirSync('./test/fixtures/testDeepReadDirSync'))).toEqual(new Set(expected));
2929
});
3030

3131
it('handles empty target directory', (done: (error?: Error) => void) => {

packages/wasm/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@sentry-internal/eslint-config-sdk": "6.10.0",
2525
"@types/jest-environment-puppeteer": "^4.4.0",
2626
"@types/puppeteer": "^5.4.0",
27+
"cross-env":"^7.0.3",
2728
"express": "^4.17.1",
2829
"jest": "^24.7.1",
2930
"jest-puppeteer": "^4.4.0",
@@ -54,7 +55,7 @@
5455
"fix": "run-s fix:eslint fix:prettier",
5556
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
5657
"fix:eslint": "eslint . --format stylish --fix",
57-
"test": "PORT=1337 jest",
58+
"test": "cross-env PORT=1337 jest",
5859
"test:watch": "jest --watch",
5960
"pack": "npm pack",
6061
"circularDepCheck": "madge --circular src/index.ts"

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7266,6 +7266,13 @@ create-react-context@^0.2.2:
72667266
fbjs "^0.8.0"
72677267
gud "^1.0.0"
72687268

7269+
cross-env@^7.0.3:
7270+
version "7.0.3"
7271+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
7272+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
7273+
dependencies:
7274+
cross-spawn "^7.0.1"
7275+
72697276
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
72707277
version "6.0.5"
72717278
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
@@ -7277,7 +7284,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
72777284
shebang-command "^1.2.0"
72787285
which "^1.2.9"
72797286

7280-
cross-spawn@^7.0.0, cross-spawn@^7.0.2:
7287+
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
72817288
version "7.0.3"
72827289
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
72837290
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==

0 commit comments

Comments
 (0)