11"use strict" ;
2- var __importDefault = ( this && this . __importDefault ) || function ( mod ) {
3- return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
4- } ;
5- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
6- const index_js_1 = require ( "./index.js" ) ;
7- const qunit_1 = __importDefault ( require ( "qunit" ) ) ;
8- const child_process_1 = __importDefault ( require ( "child_process" ) ) ;
2+
3+ const { Scenarios } = require ( 'scenario-tester' ) ;
4+ const qunit = require ( "qunit" ) ;
5+ const child_process = require ( "child_process" ) ;
6+ const execa = require ( 'execa' ) ;
7+
98function hello1 ( project ) {
109 project . linkDependency ( 'hello' , {
11- baseDir : './fixtures' ,
10+ baseDir : './tests/ fixtures' ,
1211 resolveName : 'hello1' ,
1312 } ) ;
1413}
1514function hello2 ( project ) {
1615 project . linkDependency ( 'hello' , {
17- baseDir : './fixtures' ,
16+ baseDir : './tests/ fixtures' ,
1817 resolveName : 'hello' ,
1918 } ) ;
2019}
21- const scenarios = index_js_1 . Scenarios . fromDir ( './fixtures/app' ) . expand ( {
20+ const scenarios = Scenarios . fromDir ( './tests /fixtures/app' ) . expand ( {
2221 hello1,
2322 hello2,
2423} ) ;
2524scenarios . forEachScenario ( ( scenario ) => {
26- qunit_1 . default . module ( scenario . name , ( hooks ) => {
25+ qunit . module ( scenario . name , ( hooks ) => {
2726 hooks . before ( async function ( ) {
2827 this . app = await scenario . prepare ( ) ;
2928 } ) ;
30- qunit_1 . default . test ( 'yarn test' , async function ( assert ) {
29+ qunit . test ( 'yarn test' , async function ( assert ) {
3130 const result = await this . app . execute ( 'yarn --silent test' ) ;
3231 assert . equal ( result . stdout , `TAP version 13
3332ok 1 project > createHello
@@ -38,25 +37,28 @@ ok 1 project > createHello
3837# fail 0
3938` ) ;
4039 } ) ;
41- qunit_1 . default . test ( 'yarn bin inside app' , async function ( assert ) {
40+ qunit . test ( 'yarn bin inside app' , async function ( assert ) {
4241 let result = await this . app . execute ( 'yarn --silent bin' ) ;
4342 const yarnBin = result . stdout . trimRight ( ) ;
4443 assert . ok ( yarnBin . startsWith ( this . app . dir ) ) ;
4544 result = await this . app . execute ( 'yarn --silent exec which qunit' ) ;
4645 assert . ok ( result . stdout . startsWith ( yarnBin ) ) ;
4746 } ) ;
48- qunit_1 . default . test ( 'check scenario' , async function ( assert ) {
47+ qunit . test ( 'check scenario' , async function ( assert ) {
4948 let result = await this . app . execute ( `node -p 'require("./index").polyfilled'` ) ;
5049 assert . equal ( result . stdout . trim ( ) , ( 'hello1' === scenario . name ) . toString ( ) ) ;
5150 } ) ;
5251 } ) ;
5352} ) ;
54- qunit_1 . default . module ( 'cli' , ( ) => {
55- qunit_1 . default . test ( 'list' , ( assert ) => {
56- assert . deepEqual ( child_process_1 . default
57- . execFileSync ( process . execPath , [ 'cli.js' , 'list' , '--files' , 'test.js' , '--matrix' ] , { encoding : 'utf8' } )
58- . trimRight ( )
59- . split ( '\n' ) , [ 'hello1' , 'hello2' ] ) ;
53+ qunit . module ( 'cli' , ( ) => {
54+ qunit . test ( 'list' , async ( assert ) => {
55+ const result = await execa ( 'npx' , [ 'scenario-tester' , 'list' , '--files' , 'tests/test.cjs' , '--matrix' ] )
56+
57+ const { stdout } = result ;
58+ assert . deepEqual (
59+ stdout . split ( '\n' ) ,
60+ [ 'hello1' , 'hello2' ]
61+ ) ;
6062 } ) ;
6163} ) ;
62- //# sourceMappingURL=test.js.map
64+ //# sourceMappingURL=test.js.map
0 commit comments