Skip to content

Commit

Permalink
Merge pull request #1465 from Daniel15/appveyor
Browse files Browse the repository at this point in the history
Add AppVeyor configuration
  • Loading branch information
cpojer committed Sep 3, 2016
2 parents 87eaa07 + 8425a27 commit c8a18d4
Show file tree
Hide file tree
Showing 33 changed files with 164 additions and 9 deletions.
23 changes: 23 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
environment:
matrix:
#- nodejs_version: "4"
- nodejs_version: "6"

install:
- ps: Install-Product node $env:nodejs_version x64
- npm i -g npm@latest
- node --version
- npm --version
- npm install

test_script:
- npm run build
# Some snapshot tests don't currently work on Windows, so the tests are
# commented out. Jest complains that obsolete snapshot files exist, so the
# "-u" will just delete those snapshots when running in the AppVeyor run,
# instead of failing the build. Note that this means that all snapshot tests
# WILL ALWAYS PASS, as it updates the snapshots.
- npm run jest -- -u --color

# Don't actually build.
build: off
15 changes: 10 additions & 5 deletions integration_tests/__tests__/babel-plugin-jest-hoist-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
const {linkJestPackage, run} = require('../utils');
const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

const DIR = path.resolve(__dirname, '..', 'babel-plugin-jest-hoist');

beforeEach(() => {
run('npm i', DIR);
linkJestPackage('babel-plugin-jest-hoist', DIR);
linkJestPackage('babel-jest', DIR);
});
skipOnWindows.suite();

if (process.platform !== 'win32') {
beforeEach(() => {
run('npm i', DIR);
linkJestPackage('babel-plugin-jest-hoist', DIR);
linkJestPackage('babel-jest', DIR);
});
}

it('sucessfully runs the tests inside `babel-plugin-jest-hoist/`', () => {
const {json} = runJest.json(DIR, ['--no-cache']);
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

skipOnWindows.suite();

test('config as JSON', () => {
const result = runJest('verbose_reporter', [
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/console-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

skipOnWindows.suite();

test('console printing', () => {
const result = runJest('console');
Expand Down
7 changes: 6 additions & 1 deletion integration_tests/__tests__/coverage_report-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ const {linkJestPackage} = require('../utils');
const runJest = require('../runJest');
const fs = require('fs');
const path = require('path');
const skipOnWindows = require('skipOnWindows');

const DIR = path.resolve(__dirname, '../coverage_report');

beforeEach(() => linkJestPackage('babel-jest', DIR));
if (process.platform !== 'win32') {
beforeEach(() => linkJestPackage('babel-jest', DIR));
}

skipOnWindows.suite();

test('outputs coverage report', () => {
const {stdout, status} = runJest(DIR, ['--no-cache', '--coverage']);
Expand Down
7 changes: 6 additions & 1 deletion integration_tests/__tests__/debug-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
const {linkJestPackage} = require('../utils');
const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

describe('jest --debug', () => {
skipOnWindows.suite();

const dir = path.resolve(__dirname, '..', 'verbose_reporter');

beforeEach(() => {
linkJestPackage('babel-jest', dir);
if (process.platform !== 'win32') {
linkJestPackage('babel-jest', dir);
}
});

it('outputs debugging info before running the test', () => {
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/empty_suite_error-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

const DIR = path.resolve(__dirname, '../empty_suite_error');

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

it('fails the test suite if it contains no tests', () => {
const result = runJest(DIR, []);
const stderr = result.stderr.toString();
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/__tests__/env-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

const getLog = result => result.stdout.toString().split('\n')[1].trim();

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

it('uses jsdom when specified', () => {
const result = runJest('env-test', ['--env=jsdom']);
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/failures-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

const dir = path.resolve(__dirname, '../failures');

skipOnWindows.suite();

test('throwing not Error objects', () => {
let stderr;
stderr = runJest(dir, ['throw-number-test.js']).stderr;
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/jasmine_async-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

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

it('works with beforeAll', () => {
const result = runJest.json(
'jasmine_async',
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/json_reporter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

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

it('outputs coverage report', () => {
const result = runJest('json_reporter', ['--json']);
const stdout = result.stdout.toString();
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/no-test-found-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

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

it('outputs coverage report', () => {
const result = runJest('coverage_report', ['not-a-valid-test']);
const stdout = result.stdout.toString();
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/regex-(char-in-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

describe('Regex Char In Path', () => {
skipOnWindows.suite();

it('parses paths containing regex chars correctly', () => {
const {json} = runJest.json('regex-(char-in-path', []);

Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/set-immediate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

skipOnWindows.suite();

test('setImmediate', () => {
const result = runJest('set_immediate', ['--verbose']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

describe('--setupTestFrameworkScriptFile setup.js', () => {
skipOnWindows.suite();

it('requires a setup file before each file in the suite', () => {
const result = runJest.json('setup_test_framework_script_file_cli_config', [
'--setupTestFrameworkScriptFile',
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/__tests__/snapshot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
const fs = require('fs');
const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

const emptyTest = 'describe("", () => {it("", () => {})})';
const snapshotDir =
Expand Down Expand Up @@ -54,6 +55,7 @@ const getSnapshotOfCopy = () => {
};

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

const cleanup = () => {
[
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/__tests__/stack_trace-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

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

it('prints a stack trace for runtime errors', () => {
const result = runJest('stack_trace', ['runtime-error-test.js']);
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/testcheck-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

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

it('works', () => {
const result = runJest.json('testcheck', ['testcheck-test.js']);
const json = result.json;
Expand Down
8 changes: 6 additions & 2 deletions integration_tests/__tests__/transform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
const {linkJestPackage, run} = require('../utils');
const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

describe('babel-jest', () => {
skipOnWindows.suite();
const dir = path.resolve(__dirname, '..', 'transform/babel-jest');

beforeEach(() => {
run('npm install', dir);
linkJestPackage('babel-jest', dir);
if (process.platform !== 'win32') {
run('npm install', dir);
linkJestPackage('babel-jest', dir);
}
});

it('runs transpiled code', () => {
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/typescript-coverage-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
const {run} = require('../utils');
const path = require('path');
const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

skipOnWindows.suite();

it('instruments and collects coverage for typescript files', () => {
const dir = path.resolve(__dirname, '../typescript-coverage');
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/__tests__/verbose-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'use strict';

const runJest = require('../runJest');
const skipOnWindows = require('skipOnWindows');

skipOnWindows.suite();

test('Verbose Reporter', () => {
const result = runJest('verbose_reporter');
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-changed-files/src/__tests__/git-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('git', () => {
childProcess.spawnSync('git', ['init', tmpdir]);

return git.isGitRepository(tmpdir).then(res => {
if (process.platform === 'win32') {
// Git port on Win32 returns paths with "/" rather than "\"
res = res.replace(/\//g, '\\');
}
expect(res).toContain(tmpdir);
});
});
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-cli/src/__tests__/SearchSource-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;

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

const rootDir = path.resolve(__dirname, 'test_root');
const testRegex = path.sep + '__testtests__' + path.sep;
Expand All @@ -21,6 +22,8 @@ let findMatchingTests;
let normalizeConfig;

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

const name = 'SearchSource';
let Runtime;
let SearchSource;
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-haste-map/src/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
'use strict';

const skipOnWindows = require('skipOnWindows');

jest.mock('child_process', () => ({
// If this does not throw, we'll use the (mocked) watchman crawler
execSync() {},
Expand Down Expand Up @@ -59,6 +61,7 @@ let workerFarmMock;
let writeFileSync;

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

beforeEach(() => {
jest.resetModules();
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-haste-map/src/__tests__/worker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'use strict';

const H = require('../constants');
const skipOnWindows = require('skipOnWindows');
const worker = require('../worker');

const fs = require('graceful-fs');
Expand All @@ -21,6 +22,7 @@ let readFileSync;
let workerError;

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

beforeEach(() => {
mockFs = {
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-haste-map/src/crawlers/__tests__/node-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
'use strict';

const skipOnWindows = require('skipOnWindows');

jest.mock('child_process', () => ({
spawn: jest.fn((cmd, args) => {
let closeCallback;
Expand Down Expand Up @@ -67,6 +69,7 @@ let nodeCrawl;
let childProcess;

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

beforeEach(() => {
jest.resetModules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
'use strict';

const skipOnWindows = require('skipOnWindows');

jest.mock('fb-watchman', () => {
const Client = jest.fn();
Client.prototype.command = jest.fn((args, callback) => {
Expand All @@ -30,6 +32,7 @@ let mockResponse;
let mockFiles;

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

beforeEach(() => {
watchmanCrawl = require('../watchman');
Expand Down
Loading

0 comments on commit c8a18d4

Please sign in to comment.