-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for embroider with embertemplate-imports
- Loading branch information
stefanoviv
committed
Mar 12, 2024
1 parent
5ce8e6a
commit 762b029
Showing
40 changed files
with
13,099 additions
and
8 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
test-packages/__snapshots__/my-embroider-app-template-imports-test.mjs.snap
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,116 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`app coverage generation > generates coverage with embroider and template imports 1`] = ` | ||
{ | ||
"app/app.js": { | ||
"branches": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"functions": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"lines": { | ||
"covered": 4, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 4, | ||
}, | ||
"statements": { | ||
"covered": 4, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 4, | ||
}, | ||
}, | ||
"app/components/bar.gjs": { | ||
"branches": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"functions": { | ||
"covered": 1, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 1, | ||
}, | ||
"lines": { | ||
"covered": 3, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 3, | ||
}, | ||
"statements": { | ||
"covered": 3, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 3, | ||
}, | ||
}, | ||
"app/router.js": { | ||
"branches": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"functions": { | ||
"covered": 0, | ||
"pct": 0, | ||
"skipped": 0, | ||
"total": 1, | ||
}, | ||
"lines": { | ||
"covered": 1, | ||
"pct": 33.33, | ||
"skipped": 0, | ||
"total": 3, | ||
}, | ||
"statements": { | ||
"covered": 1, | ||
"pct": 33.33, | ||
"skipped": 0, | ||
"total": 3, | ||
}, | ||
}, | ||
"total": { | ||
"branches": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"branchesTrue": { | ||
"covered": 0, | ||
"pct": 100, | ||
"skipped": 0, | ||
"total": 0, | ||
}, | ||
"functions": { | ||
"covered": 1, | ||
"pct": 50, | ||
"skipped": 0, | ||
"total": 2, | ||
}, | ||
"lines": { | ||
"covered": 8, | ||
"pct": 80, | ||
"skipped": 0, | ||
"total": 10, | ||
}, | ||
"statements": { | ||
"covered": 8, | ||
"pct": 80, | ||
"skipped": 0, | ||
"total": 10, | ||
}, | ||
}, | ||
} | ||
`; |
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,25 @@ | ||
'use strict'; | ||
|
||
import { execa } from 'execa'; | ||
import setupTestDir, { assertCoverageExists, assertFileIsNotEmpty } from './utils.mjs'; | ||
import { describe, it } from 'vitest'; | ||
|
||
const APP_DIR = 'my-embroider-app-template-imports'; | ||
|
||
describe('app coverage generation', function () { | ||
const env = { COVERAGE: 'true' }; | ||
|
||
it(`generates coverage with embroider and template imports`, async function () { | ||
let buildPath = await setupTestDir(APP_DIR, env, {}); | ||
|
||
// Embroider tries to reuse .embroider folder if present during builds. | ||
// We need make sure previous test runs don't affect newer test runs, as the embroider/core | ||
// version that generated the folder would be different to the one trying to use it, which can lead to unexpected behaviour. | ||
// await execa('rm', ['-rf', '.embroider'], { cwd: buildPath, env }); | ||
await execa('rm', ['-rf', '.embroider'], { cwd: buildPath, env }); | ||
|
||
await execa('npx', ['ember','test', '--test-port=0'], { cwd: buildPath, env }); | ||
|
||
await assertCoverageExists(`${buildPath}/coverage`); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test-packages/my-embroider-app-template-imports/.editorconfig
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,19 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
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,7 @@ | ||
{ | ||
/** | ||
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript | ||
rather than JavaScript by default, when a TypeScript version of a given blueprint is available. | ||
*/ | ||
"isTypeScriptProject": false | ||
} |
13 changes: 13 additions & 0 deletions
13
test-packages/my-embroider-app-template-imports/.eslintignore
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,13 @@ | ||
# unconventional js | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
|
||
# misc | ||
/coverage/ | ||
!.* | ||
.*/ | ||
|
||
# ember-try | ||
/.node_modules.ember-try/ |
56 changes: 56 additions & 0 deletions
56
test-packages/my-embroider-app-template-imports/.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
root: true, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
requireConfigFile: false, | ||
babelOptions: { | ||
plugins: [ | ||
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], | ||
], | ||
}, | ||
}, | ||
plugins: ['ember'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
env: { | ||
browser: true, | ||
}, | ||
rules: {}, | ||
overrides: [ | ||
// node files | ||
{ | ||
files: [ | ||
'./.eslintrc.js', | ||
'./.prettierrc.js', | ||
'./.stylelintrc.js', | ||
'./.template-lintrc.js', | ||
'./ember-cli-build.js', | ||
'./testem.js', | ||
'./blueprints/*/index.js', | ||
'./config/**/*.js', | ||
'./lib/*/index.js', | ||
'./server/**/*.js', | ||
], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
env: { | ||
browser: false, | ||
node: true, | ||
}, | ||
extends: ['plugin:n/recommended'], | ||
}, | ||
{ | ||
// test files | ||
files: ['tests/**/*-test.{js,ts}'], | ||
extends: ['plugin:qunit/recommended'], | ||
}, | ||
], | ||
}; |
47 changes: 47 additions & 0 deletions
47
test-packages/my-embroider-app-template-imports/.github/workflows/ci.yml
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,47 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: {} | ||
|
||
concurrency: | ||
group: ci-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: "Lint" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint | ||
|
||
test: | ||
name: "Test" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm test |
25 changes: 25 additions & 0 deletions
25
test-packages/my-embroider-app-template-imports/.gitignore
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,25 @@ | ||
# compiled output | ||
/dist/ | ||
/declarations/ | ||
|
||
# dependencies | ||
/node_modules/ | ||
|
||
# misc | ||
/.env* | ||
/.pnp* | ||
/.eslintcache | ||
/coverage/ | ||
/npm-debug.log* | ||
/testem.log | ||
/yarn-error.log | ||
|
||
# ember-try | ||
/.node_modules.ember-try/ | ||
/npm-shrinkwrap.json.ember-try | ||
/package.json.ember-try | ||
/package-lock.json.ember-try | ||
/yarn.lock.ember-try | ||
|
||
# broccoli-debug | ||
/DEBUG/ |
13 changes: 13 additions & 0 deletions
13
test-packages/my-embroider-app-template-imports/.prettierignore
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,13 @@ | ||
# unconventional js | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
|
||
# misc | ||
/coverage/ | ||
!.* | ||
.*/ | ||
|
||
# ember-try | ||
/.node_modules.ember-try/ |
Oops, something went wrong.