Skip to content

Commit

Permalink
Enable all jest-runtime tests on Windows. (#3041)
Browse files Browse the repository at this point in the history
* Enable all `jest-runtime` tests on Windows.

* Nix `skipOnWindows`.

* Remove `rimraf` usage.
  • Loading branch information
wtgtybhertgeghgtwtg authored and cpojer committed Mar 2, 2017
1 parent edaff5a commit 949e3c2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"chalk": "^1.1.3",
"codecov": "^1.0.1",
"cross-spawn": "^5.1.0",
"eslint": "^3.11.1",
"eslint-plugin-babel": "^4.0.0",
"eslint-plugin-flowtype": "^2.28.2",
Expand All @@ -29,6 +30,7 @@
"react": "^15.4.1",
"react-test-renderer": "^15.4.1",
"rimraf": "^2.5.4",
"slash": "^1.0.0",
"strip-ansi": "^3.0.1",
"typescript": "^2.1.4"
},
Expand Down
5 changes: 1 addition & 4 deletions packages/jest-runtime/src/__tests__/Runtime-cli-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
*/
'use strict';

const skipOnWindows = require('skipOnWindows');
const spawnSync = require('child_process').spawnSync;
const spawnSync = require('cross-spawn').sync;
const path = require('path');

const JEST_RUNTIME = path.resolve(__dirname, '../../bin/jest-runtime.js');
Expand All @@ -22,8 +21,6 @@ const run = args => spawnSync(JEST_RUNTIME, args, {
});

describe('Runtime', () => {
skipOnWindows.suite();

describe('cli', () => {
it('fails with no path', () => {
const expectedOutput =
Expand Down
8 changes: 3 additions & 5 deletions packages/jest-runtime/src/__tests__/transform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const skipOnWindows = require('skipOnWindows');
const slash = require('slash');

jest
.mock('graceful-fs')
Expand Down Expand Up @@ -116,7 +116,8 @@ describe('transform', () => {
});
fs.writeFileSync = jest.fn((path, data, options) => {
expect(options).toBe('utf8');
mockFs[path] = data;
const normalizedPath = slash(path);
mockFs[normalizedPath] = data;
});

fs.unlinkSync = jest.fn();
Expand Down Expand Up @@ -213,9 +214,6 @@ describe('transform', () => {
});

it('reads values from the cache', () => {
if (skipOnWindows.test()) {
return;
}
const transformConfig = Object.assign(config, {
transform: [['^.+\\.js$', 'test-preprocessor']],
});
Expand Down
5 changes: 3 additions & 2 deletions packages/jest-runtime/src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const path = require('path');
const shouldInstrument = require('./shouldInstrument');
const stableStringify = require('json-stable-stringify');
const vm = require('vm');
const slash = require('slash');

const VERSION = require('../package.json').version;

Expand Down Expand Up @@ -172,10 +173,10 @@ const getFileCachePath = (
// Create sub folders based on the cacheKey to avoid creating one
// directory with many files.
const cacheDir = path.join(baseCacheDir, cacheKey[0] + cacheKey[1]);
const cachePath = path.join(
const cachePath = slash(path.join(
cacheDir,
path.basename(filename, path.extname(filename)) + '_' + cacheKey,
);
));
createDirectory(cacheDir);

return cachePath;
Expand Down
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ cross-spawn@^4.0.0:
lru-cache "^4.0.1"
which "^1.2.9"

cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies:
lru-cache "^4.0.1"
shebang-command "^1.2.0"
which "^1.2.9"

[email protected]:
version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
Expand Down Expand Up @@ -2147,6 +2155,16 @@ setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"

shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"

shelljs@^0.7.5:
version "0.7.6"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
Expand Down

0 comments on commit 949e3c2

Please sign in to comment.