Skip to content

Commit 42d3797

Browse files
jeysalSimenB
authored andcommitted
e2e test running Jest programmatically
1 parent 74a7719 commit 42d3797

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
import {resolve} from 'path';
11+
12+
import {run} from '../Utils';
13+
14+
const dir = resolve(__dirname, '..', 'run-programatically');
15+
16+
test('run Jest programatically', () => {
17+
const {stdout} = run(`node index.js --version`, dir);
18+
expect(stdout).toMatch(/\d{2}\.\d{1,2}\.\d{1,2}[\-\S]*-dev$/);
19+
});

e2e/run-programatically/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*
8+
* @flow
9+
*/
10+
11+
// Running Jest like this is not officially supported,
12+
// but it is common practice until there is a proper API as a substitute.
13+
require('jest').run(process.argv);

0 commit comments

Comments
 (0)