-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
331 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/*.d.ts | ||
/*.js | ||
/*.js.map | ||
/build/ | ||
/*.log | ||
/typedoc | ||
!.eslintrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { Scenarios } from 'scenario-tester'; | ||
import Qunit from 'qunit'; | ||
import execa from 'execa'; | ||
|
||
function hello1(project) { | ||
project.linkDependency('hello', { | ||
baseDir: './tests/fixtures', | ||
resolveName: 'hello1', | ||
}); | ||
} | ||
|
||
function hello2(project) { | ||
project.linkDependency('hello', { | ||
baseDir: './tests/fixtures', | ||
resolveName: 'hello', | ||
}); | ||
} | ||
|
||
const scenarios = Scenarios.fromDir('./tests/fixtures/app').expand({ | ||
hello1, | ||
hello2, | ||
}); | ||
|
||
|
||
scenarios.forEachScenario((scenario) => { | ||
Qunit.module(scenario.name, (hooks) => { | ||
hooks.before(async function () { | ||
this.app = await scenario.prepare(); | ||
}); | ||
|
||
Qunit.test( | ||
'yarn test', | ||
async function (assert) { | ||
const result = await this.app.execute('yarn --silent test'); | ||
assert.equal( | ||
result.stdout, | ||
`TAP version 13 | ||
ok 1 project > createHello | ||
1..1 | ||
# pass 1 | ||
# skip 0 | ||
# todo 0 | ||
# fail 0 | ||
` | ||
); | ||
} | ||
); | ||
|
||
Qunit.test( | ||
'yarn bin inside app', | ||
async function (assert) { | ||
let result = await this.app.execute('yarn --silent bin'); | ||
const yarnBin = result.stdout.trimRight(); | ||
assert.ok(yarnBin.startsWith(this.app.dir)); | ||
result = await this.app.execute('yarn --silent exec which qunit'); | ||
assert.ok(result.stdout.startsWith(yarnBin)); | ||
} | ||
); | ||
|
||
Qunit.test( | ||
'check scenario', | ||
async function (assert) { | ||
let result = await this.app.execute( | ||
`node -p 'require("./index").polyfilled'` | ||
); | ||
assert.equal( | ||
result.stdout.trim(), | ||
('hello1' === scenario.name).toString() | ||
); | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
Qunit.module('cli', () => { | ||
Qunit.test('list', async (assert) => { | ||
const result = await execa('npx', ['.', 'list', '--files', 'tests/test.mjs', '--matrix']) | ||
|
||
const { stdout } = result; | ||
assert.deepEqual( | ||
stdout.split('\n'), | ||
['hello1', 'hello2'] | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./build/types", | ||
"target": "ES2020", | ||
"module": "ES2020", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"esModuleInterop": true, | ||
}, | ||
"exclude": ["tests", "build"] | ||
} |
Oops, something went wrong.