Skip to content

Commit 6070609

Browse files
thymikeeSimenB
authored andcommitted
feat: bump jest 24; add todo helper (#14)
1 parent 2542346 commit 6070609

File tree

14 files changed

+795
-849
lines changed

14 files changed

+795
-849
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// 📃
2+
console.log();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
runner: require.resolve('../../runner'),
3+
testMatch: ['**/__src__/**/*.js'],
4+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Works when it has todo tests 1`] = `
4+
"PASS integrationTests/__fixtures__/todo/__src__/file1.js
5+
6+
Test Suites: 1 passed, 1 total
7+
Tests: 1 todo, 1 total
8+
Snapshots: 0 total
9+
Time:
10+
Ran all test suites.
11+
"
12+
`;

integrationTests/runJest.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
2-
const execa = require('execa');
1+
const execa = require('execa'); // eslint-disable-line import/no-extraneous-dependencies
32
const path = require('path');
43

54
const rootDir = path.resolve(__dirname, '..');
@@ -16,7 +15,7 @@ const normalize = output =>
1615

1716
const runJest = (project, options = []) => {
1817
// eslint-disable-next-line
19-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
18+
jest.setTimeout(15000);
2019
return execa(
2120
'jest',
2221
[

integrationTests/runner/run.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fs = require('fs');
2-
const { pass, fail, skip } = require('../../');
2+
const { pass, fail, skip, todo } = require('../../');
33

44
module.exports = ({ testPath }) => {
55
const start = Date.now();
@@ -12,6 +12,9 @@ module.exports = ({ testPath }) => {
1212
if (contents.includes('🙈')) {
1313
return skip({ start, end, test: { path: testPath } });
1414
}
15+
if (contents.includes('📃')) {
16+
return todo({ start, end, test: { path: testPath } });
17+
}
1518
const errorMessage = 'Company policies require ⚔️ 🏃 in every file';
1619
return fail({
1720
start,

integrationTests/todo.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const runJest = require('./runJest');
2+
3+
it('Works when it has todo tests', () => {
4+
return expect(runJest('todo')).resolves.toMatchSnapshot();
5+
});

lib/fail.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const fail = ({ start, end, test, errorMessage }) =>
77
failures: 1,
88
pending: 0,
99
passes: 0,
10+
todo: 0,
1011
start,
1112
end,
1213
},

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as createJestRunner } from './createJestRunner';
22
export { default as fail } from './fail';
33
export { default as pass } from './pass';
44
export { default as skip } from './skip';
5+
export { default as todo } from './todo';

lib/pass.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const pass = ({ start, end, test }) =>
66
failures: 0,
77
pending: 0,
88
passes: 1,
9+
todo: 0,
910
start,
1011
end,
1112
},

lib/skip.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const skip = ({ start, end, test }) =>
66
failures: 0,
77
pending: 1,
88
passes: 0,
9+
todo: 0,
910
start,
1011
end,
1112
},

0 commit comments

Comments
 (0)