forked from salesforce-ux/design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.local.js
43 lines (38 loc) · 1.42 KB
/
jest.local.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
const { execSync, spawn, fork } = require('child_process');
const path = require('path');
execSync('npm run build', { stdio: ['inherit', 'inherit', 'inherit'] });
execSync('npm run test:compile-integration', {
stdio: ['inherit', 'inherit', 'inherit']
});
// travis runs the same thing, but slightly different to break the build on err
// Check jest.travis.js
const jest = spawn('./node_modules/.bin/jest', process.argv.slice(2), {
cwd: path.resolve(__dirname),
stdio: 'inherit'
});
if (process.argv.includes('--watch')) {
const glob = require('glob');
const gulp = require('gulp');
const touch = require('touch');
const paths = require('./scripts/helpers/paths');
const { watchPaths } = require('./scripts/watch');
require('./scripts/gulp/styles');
gulp.watch(watchPaths.sass, changeEvent => {
console.log(`${changeEvent.path}`);
console.log(`Compiling Sass...`);
gulp.start('styles:sass', err => {
if (err) return console.log(err);
const pattern = /ui\/(.+?)\/(.+?)\//;
const match = changeEvent.path.match(pattern);
if (match) {
const [type, id] = match.slice(1);
glob
.sync(path.resolve(__dirname, `ui/${type}/${id}/**/*.spec.{js,jsx}`))
.slice(0, 1)
.map(p => touch.sync(p));
}
});
});
}