File tree Expand file tree Collapse file tree 5 files changed +16
-13
lines changed
test/snapshot-regenerate-report Expand file tree Collapse file tree 5 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import {workerData} from 'node:worker_threads';
5
5
6
6
import setUpCurrentlyUnhandled from 'currently-unhandled' ;
7
7
8
- import { set as setChalk } from '../chalk.js' ;
9
8
import nowAndTimers from '../now-and-timers.cjs' ;
10
9
import providerManager from '../provider-manager.js' ;
11
10
import Runner from '../runner.js' ;
@@ -22,7 +21,6 @@ const currentlyUnhandled = setUpCurrentlyUnhandled();
22
21
23
22
const run = async options => {
24
23
setOptions ( options ) ;
25
- setChalk ( options . chalkOptions ) ;
26
24
27
25
if ( options . chalkOptions . level > 0 ) {
28
26
const { stdout, stderr} = process ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
+ const chalk = import ( '../chalk.js' ) ; // eslint-disable-line node/no-unsupported-features/es-syntax
3
+ let setChalk ;
4
+ chalk . then ( chalk => {
5
+ setChalk = chalk . set ;
6
+ } ) ;
7
+
2
8
let options = null ;
3
9
exports . get = ( ) => {
4
10
if ( ! options ) {
@@ -14,4 +20,11 @@ exports.set = newOptions => {
14
20
}
15
21
16
22
options = newOptions ;
23
+ if ( options . chalkOptions ) {
24
+ if ( setChalk ) {
25
+ setChalk ( options . chalkOptions ) ;
26
+ } else {
27
+ chalk . then ( chalk => chalk . set ( options . chalkOptions ) ) ;
28
+ }
29
+ }
17
30
} ;
Original file line number Diff line number Diff line change @@ -7,11 +7,8 @@ import {test} from 'tap';
7
7
import * as assert from '../lib/assert.js' ;
8
8
import { set as setChalk } from '../lib/chalk.js' ;
9
9
import * as snapshotManager from '../lib/snapshot-manager.js' ;
10
- import { set as setOptions } from '../lib/worker/options.cjs' ;
11
10
12
- const options = { chalkOptions : { level : 0 } } ;
13
- setOptions ( options ) ;
14
- setChalk ( options . chalkOptions ) ;
11
+ setChalk ( { level : 0 } ) ;
15
12
16
13
let lastFailure = null ;
17
14
let lastPassed = false ;
Original file line number Diff line number Diff line change 1
1
import delay from 'delay' ;
2
2
import { test } from 'tap' ;
3
3
4
- import { set as setChalk } from '../lib/chalk.js' ;
5
4
import ContextRef from '../lib/context-ref.js' ;
6
5
import { set as setOptions } from '../lib/worker/options.cjs' ;
7
6
8
7
import { newAva } from './helper/ava-test.js' ;
9
8
10
- const options = { chalkOptions : { level : 0 } } ;
11
- setOptions ( options ) ;
12
- setChalk ( options . chalkOptions ) ;
9
+ setOptions ( { chalkOptions : { level : 0 } } ) ;
13
10
14
11
test ( 'try-commit works' , async t => {
15
12
const ava = newAva ( ) ;
Original file line number Diff line number Diff line change @@ -3,13 +3,11 @@ import path from 'node:path';
3
3
4
4
import test from '@ava/test' ;
5
5
6
- import { set as setChalk } from '../../lib/chalk.js' ;
7
6
import { load } from '../../lib/snapshot-manager.js' ;
8
7
import { set as setOptions } from '../../lib/worker/options.cjs' ;
9
8
import { cwd , fixture } from '../helpers/exec.js' ;
10
9
11
- setChalk ( { level : 0 } ) ;
12
- setOptions ( { } ) ;
10
+ setOptions ( { chalkOptions : { level : 0 } } ) ;
13
11
14
12
test ( 'snapshot report can be regenerated from .snap file' , async t => {
15
13
const workingDir = cwd ( ) ;
You can’t perform that action at this time.
0 commit comments