diff --git a/tests/app-template/vite.config.mjs b/tests/app-template/vite.config.mjs index 29d608377..a25d180d3 100644 --- a/tests/app-template/vite.config.mjs +++ b/tests/app-template/vite.config.mjs @@ -38,6 +38,7 @@ export default defineConfig(({ mode }) => { }), ], optimizeDeps: optimizeDeps(), + publicDir: resolve(process.cwd(), "public"), server: { port: 4200, watch: { diff --git a/tests/scenarios/scenarios.ts b/tests/scenarios/scenarios.ts index 467c22c11..a0e611661 100644 --- a/tests/scenarios/scenarios.ts +++ b/tests/scenarios/scenarios.ts @@ -70,7 +70,6 @@ export function baseViteApp() { } export const appScenarios = supportMatrix(Scenarios.fromProject(baseApp)); -export const viteAppScenarios = supportMatrix(Scenarios.fromProject(baseViteApp)).skip('lts_3_28'); // we're standardizing on Ember's native types, which become available starting // at 4.8. So we're not going to run type tests on older releases that don't diff --git a/tests/scenarios/vite-app-test.ts b/tests/scenarios/vite-app-test.ts index c53ab3209..32102b65b 100644 --- a/tests/scenarios/vite-app-test.ts +++ b/tests/scenarios/vite-app-test.ts @@ -1,28 +1,13 @@ -import { baseAddon, viteAppScenarios } from './scenarios'; +import { baseAddon, appScenarios } from './scenarios'; import type { PreparedApp } from 'scenario-tester'; import QUnit from 'qunit'; -import { exec } from 'child_process'; import { readdirSync } from 'fs-extra'; import { join } from 'path'; const { module: Qmodule, test } = QUnit; -// cannot use util.promisify -// because then qunit will exit early with -// an error about an async hold -function execPromise(command: string): Promise { - return new Promise(function (resolve, reject) { - exec(command, (error, stdout) => { - if (error) { - reject(error); - return; - } - resolve(stdout.trim()); - }); - }); -} - -viteAppScenarios +// TODO check if we need anything in this test or if things are covered elsewhere +appScenarios .map('vite-app-basics', project => { let addon = baseAddon(); addon.pkg.name = 'my-addon'; @@ -100,6 +85,21 @@ viteAppScenarios project.addDevDependency(addon2); project.mergeFiles({ tests: { + acceptance: { + 'app-route-test.js': `import { module, test } from 'qunit'; + import { visit } from '@ember/test-helpers'; + import { setupApplicationTest } from 'app-template/tests/helpers'; + + module('Acceptance | app route', function (hooks) { + setupApplicationTest(hooks); + + test('visiting /', async function (assert) { + await visit('/'); + assert.dom().includesText('hey'); + }); + }); + `, + }, integration: { 'test-colocated-addon-component.js': ` import { module, test } from 'qunit'; @@ -123,9 +123,105 @@ viteAppScenarios }); `, + 'example-test.js': `import { module, test } from 'qunit'; + import { setupRenderingTest } from 'ember-qunit'; + import { render, rerender } from '@ember/test-helpers'; + import { hbs } from 'ember-cli-htmlbars'; + + module('Integration | Component | Example', (hooks) => { + setupRenderingTest(hooks); + + test('should have Yay for gts!', async function (assert) { + await render(hbs\` + + \`); + await rerender(); + assert.dom().includesText('Yay for gts!'); + }); + }); + `, + 'fany-test-gjs.gjs': `import { module, test } from 'qunit'; + import { setupRenderingTest } from 'ember-qunit'; + import { render, click, rerender, settled } from '@ember/test-helpers'; + import Fancy from 'app-template/components/fancy2'; + + + module('Integration | Component | Fany -- from gjs test file', (hooks) => { + setupRenderingTest(hooks); + + test('should have Yay for gts!', async function(assert) { + await render(); + await rerender() + + assert.dom().hasText('Yay for gjs!'); + }); + }); + `, + 'fany-test.gts': `import { module, test } from 'qunit'; + import { setupRenderingTest } from 'ember-qunit'; + import { render, rerender } from '@ember/test-helpers'; + import Fancy from 'app-template/components/fancy'; + + + module('Integration | Component | Fany -- from gts test file', (hooks) => { + setupRenderingTest(hooks); + + test('should have Yay for gts!', async function(assert) { + await render(); + await rerender() + + assert.dom().hasText('Yay for gts!'); + }); + }); + `, + 'fany2-test.js': `import { module, test } from 'qunit'; + import { setupRenderingTest } from 'ember-qunit'; + import { render, rerender } from '@ember/test-helpers'; + import { hbs } from 'ember-cli-htmlbars'; + + module('Integration | Component | Fany2', (hooks) => { + setupRenderingTest(hooks); + + test('should have Yay for gjs!', async function (assert) { + await render(hbs\` + + + \`); + await rerender(); + + assert.dom().includesText('Yay for gts!'); + assert.dom().includesText('Yay for gjs!'); + }); + }); + `, }, }, app: { + components: { + old: { + 'component.js': `import Component from '@glimmer/component'; + + export default class extends Component { + message = 'hi'; + } + `, + 'component.hbs': `
hey {{@message}}
`, + }, + 'example.hbs': `
hey {{@message}}
`, + 'example.js': `import Component from '@glimmer/component'; + import Fancy from './fancy'; + + export default class extends Component { + message = 'hi'; + Fancy = Fancy; + }`, + 'fancy.gts': ``, + 'fancy2.gjs': ``, + }, adapters: { 'post.js': ` import JSONAPIAdapter from '@ember-data/adapter/json-api'; @@ -156,6 +252,14 @@ viteAppScenarios } `, }, + templates: { + 'application.hbs': `{{page-title "ViteApp"}} + + + + + {{outlet}}`, + }, }, public: { posts: { @@ -184,22 +288,6 @@ viteAppScenarios app = await scenario.prepare(); }); - if (process.platform === 'win32') { - test(`correct windows path`, async function (assert) { - // windows sometimes generates short path alias 8.3 - // which leads to resolving errors later - // e.g. cannot find owning engine for C:\Users\runneradmin\AppData\Local\Temp\tmp-2256UvRXnGotcjxi\node_modules\.embroider\rewritten-app - // the value in engines are: C:\Users\RUNNER~1\AppData\Local\Temp\tmp-2256UvRXnGotcjxi\node_modules\.embroider\rewritten-app - // it looks like there is no way to fix this in JS with - // e.g fs.realpath, resolve, normalize - // Powershell command can be used, python could also resolve it... - const command = `powershell.exe -command "(Get-Item -LiteralPath '${app.dir}').FullName"`; - const dir = await execPromise(command); - app.dir = dir; - assert.ok(!dir.includes('~')); - }); - } - test(`pnpm test:ember`, async function (assert) { // this will only hang if there is an issue assert.timeout(5 * 60 * 1000); @@ -209,8 +297,6 @@ viteAppScenarios assert.ok(result.output.includes('should have Yay for gjs!'), 'should have tested'); assert.ok(result.output.includes(' -- from gjs test file'), 'should have tested with gjs file'); assert.ok(result.output.includes(' -- from gts test file'), 'should have tested with gts file'); - const depCache = readdirSync(join(app.dir, 'node_modules', '.vite', 'deps')); - assert.ok(depCache.length > 0, 'should have created cached deps'); }); test(`pnpm build`, async function (assert) { @@ -219,7 +305,6 @@ viteAppScenarios const distFiles = readdirSync(join(app.dir, 'dist')); assert.ok(distFiles.length > 1, 'should have created dist folder'); assert.ok(distFiles.includes('assets'), 'should have created assets folder'); - assert.ok(distFiles.includes('ember-welcome-page'), 'should have copied addon asset files'); assert.ok(distFiles.includes('robots.txt'), 'should have copied app assets'); const assetFiles = readdirSync(join(app.dir, 'dist', 'assets')); diff --git a/tests/vite-app/.editorconfig b/tests/vite-app/.editorconfig deleted file mode 100644 index c35a00240..000000000 --- a/tests/vite-app/.editorconfig +++ /dev/null @@ -1,19 +0,0 @@ -# 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 diff --git a/tests/vite-app/.ember-cli b/tests/vite-app/.ember-cli deleted file mode 100644 index 8c1812cff..000000000 --- a/tests/vite-app/.ember-cli +++ /dev/null @@ -1,15 +0,0 @@ -{ - /** - Ember CLI sends analytics information by default. The data is completely - anonymous, but there are times when you might want to disable this behavior. - - Setting `disableAnalytics` to true will prevent any data from being sent. - */ - "disableAnalytics": false, - - /** - 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 -} diff --git a/tests/vite-app/.eslintignore b/tests/vite-app/.eslintignore deleted file mode 100644 index 9385391f2..000000000 --- a/tests/vite-app/.eslintignore +++ /dev/null @@ -1,13 +0,0 @@ -# unconventional js -/blueprints/*/files/ - -# compiled output -/dist/ - -# misc -/coverage/ -!.* -.*/ - -# ember-try -/.node_modules.ember-try/ diff --git a/tests/vite-app/.eslintrc.js b/tests/vite-app/.eslintrc.js deleted file mode 100644 index 11390f731..000000000 --- a/tests/vite-app/.eslintrc.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -module.exports = { - root: true, - parser: '@babel/eslint-parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - requireConfigFile: false, - babelOptions: { - configFile: false, - 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', - './babel.config.js', - ], - parserOptions: { - sourceType: 'script', - }, - env: { - browser: false, - node: true, - }, - extends: ['plugin:n/recommended'], - }, - { - // test files - files: ['tests/**/*-test.{js,ts}'], - extends: ['plugin:qunit/recommended'], - }, - ], -}; diff --git a/tests/vite-app/.github/workflows/ci.yml b/tests/vite-app/.github/workflows/ci.yml deleted file mode 100644 index abe311381..000000000 --- a/tests/vite-app/.github/workflows/ci.yml +++ /dev/null @@ -1,47 +0,0 @@ -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: 16 - 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: 16 - cache: npm - - name: Install Dependencies - run: npm ci - - name: Run Tests - run: npm test diff --git a/tests/vite-app/.gitignore b/tests/vite-app/.gitignore deleted file mode 100644 index 2f6fd0493..000000000 --- a/tests/vite-app/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# compiled output -/dist/ - -# 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/ diff --git a/tests/vite-app/.prettierignore b/tests/vite-app/.prettierignore deleted file mode 100644 index 36fb30cbc..000000000 --- a/tests/vite-app/.prettierignore +++ /dev/null @@ -1,15 +0,0 @@ -# unconventional js -/blueprints/*/files/ - -# compiled output -/dist/ - -# misc -/coverage/ -!.* -.*/ - -# ember-try -/.node_modules.ember-try/ - -**/*.gjs \ No newline at end of file diff --git a/tests/vite-app/.prettierrc.js b/tests/vite-app/.prettierrc.js deleted file mode 100644 index e5f7b6d1e..000000000 --- a/tests/vite-app/.prettierrc.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -module.exports = { - overrides: [ - { - files: '*.{js,ts}', - options: { - singleQuote: true, - }, - }, - ], -}; diff --git a/tests/vite-app/.stylelintignore b/tests/vite-app/.stylelintignore deleted file mode 100644 index a0cf71cbd..000000000 --- a/tests/vite-app/.stylelintignore +++ /dev/null @@ -1,8 +0,0 @@ -# unconventional files -/blueprints/*/files/ - -# compiled output -/dist/ - -# addons -/.node_modules.ember-try/ diff --git a/tests/vite-app/.stylelintrc.js b/tests/vite-app/.stylelintrc.js deleted file mode 100644 index 021c539ad..000000000 --- a/tests/vite-app/.stylelintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], -}; diff --git a/tests/vite-app/.template-lintrc.js b/tests/vite-app/.template-lintrc.js deleted file mode 100644 index f35f61c7b..000000000 --- a/tests/vite-app/.template-lintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: 'recommended', -}; diff --git a/tests/vite-app/.watchmanconfig b/tests/vite-app/.watchmanconfig deleted file mode 100644 index f9c3d8f84..000000000 --- a/tests/vite-app/.watchmanconfig +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ignore_dirs": ["dist"] -} diff --git a/tests/vite-app/README.md b/tests/vite-app/README.md deleted file mode 100644 index a888712e7..000000000 --- a/tests/vite-app/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# vite-app - -This README outlines the details of collaborating on this Ember application. -A short introduction of this app could easily go here. - -## Prerequisites - -You will need the following things properly installed on your computer. - -* [Git](https://git-scm.com/) -* [Node.js](https://nodejs.org/) (with npm) -* [Ember CLI](https://cli.emberjs.com/release/) -* [Google Chrome](https://google.com/chrome/) - -## Installation - -* `git clone ` this repository -* `cd vite-app` -* `npm install` - -## Running / Development - -* `ember serve` -* Visit your app at [http://localhost:4200](http://localhost:4200). -* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). - -### Code Generators - -Make use of the many generators for code, try `ember help generate` for more details - -### Running Tests - -* `ember test` -* `ember test --server` - -### Linting - -* `npm run lint` -* `npm run lint:fix` - -### Building - -* `ember build` (development) -* `ember build --environment production` (production) - -### Deploying - -Specify what it takes to deploy your app. - -## Further Reading / Useful Links - -* [ember.js](https://emberjs.com/) -* [ember-cli](https://cli.emberjs.com/release/) -* Development Browser Extensions - * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) - * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) diff --git a/tests/vite-app/app/app.js b/tests/vite-app/app/app.js deleted file mode 100644 index 984ab9c35..000000000 --- a/tests/vite-app/app/app.js +++ /dev/null @@ -1,12 +0,0 @@ -import Application from '@ember/application'; -import Resolver from 'ember-resolver'; -import loadInitializers from 'ember-load-initializers'; -import config from 'vite-app/config/environment'; - -export default class App extends Application { - modulePrefix = config.modulePrefix; - podModulePrefix = config.podModulePrefix; - Resolver = Resolver; -} - -loadInitializers(App, config.modulePrefix); diff --git a/tests/vite-app/app/components/.gitkeep b/tests/vite-app/app/components/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/app/components/example.hbs b/tests/vite-app/app/components/example.hbs deleted file mode 100644 index 6224387ee..000000000 --- a/tests/vite-app/app/components/example.hbs +++ /dev/null @@ -1 +0,0 @@ -
hey {{@message}}
\ No newline at end of file diff --git a/tests/vite-app/app/components/example.js b/tests/vite-app/app/components/example.js deleted file mode 100644 index 2a56a8be2..000000000 --- a/tests/vite-app/app/components/example.js +++ /dev/null @@ -1,7 +0,0 @@ -import Component from '@glimmer/component'; -import Fancy from './fancy'; - -export default class extends Component { - message = 'hi'; - Fancy = Fancy; -} diff --git a/tests/vite-app/app/components/fancy.gts b/tests/vite-app/app/components/fancy.gts deleted file mode 100644 index b66c97305..000000000 --- a/tests/vite-app/app/components/fancy.gts +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/vite-app/app/components/fancy2.gjs b/tests/vite-app/app/components/fancy2.gjs deleted file mode 100644 index 058bc8366..000000000 --- a/tests/vite-app/app/components/fancy2.gjs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/vite-app/app/components/old/component.js b/tests/vite-app/app/components/old/component.js deleted file mode 100644 index 6e87f704f..000000000 --- a/tests/vite-app/app/components/old/component.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@glimmer/component'; - -export default class extends Component { - message = 'hi'; -} diff --git a/tests/vite-app/app/components/old/template.hbs b/tests/vite-app/app/components/old/template.hbs deleted file mode 100644 index 6224387ee..000000000 --- a/tests/vite-app/app/components/old/template.hbs +++ /dev/null @@ -1 +0,0 @@ -
hey {{@message}}
\ No newline at end of file diff --git a/tests/vite-app/app/controllers/.gitkeep b/tests/vite-app/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/app/helpers/.gitkeep b/tests/vite-app/app/helpers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/app/index.html b/tests/vite-app/app/index.html deleted file mode 100644 index 0654991fe..000000000 --- a/tests/vite-app/app/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - ViteApp - - - - {{content-for "head"}} - - - - - {{content-for "head-footer"}} - - - {{content-for "body"}} - - - - - {{content-for "body-footer"}} - - diff --git a/tests/vite-app/app/models/.gitkeep b/tests/vite-app/app/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/app/router.js b/tests/vite-app/app/router.js deleted file mode 100644 index 90902c7cb..000000000 --- a/tests/vite-app/app/router.js +++ /dev/null @@ -1,9 +0,0 @@ -import EmberRouter from '@ember/routing/router'; -import config from 'vite-app/config/environment'; - -export default class Router extends EmberRouter { - location = config.locationType; - rootURL = config.rootURL; -} - -Router.map(function () {}); diff --git a/tests/vite-app/app/routes/.gitkeep b/tests/vite-app/app/routes/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/app/routes/application.ts b/tests/vite-app/app/routes/application.ts deleted file mode 100644 index 8081a2955..000000000 --- a/tests/vite-app/app/routes/application.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class extends Route { - async model() { - return { message: 'Hello world' }; - } -} diff --git a/tests/vite-app/app/styles/app.css b/tests/vite-app/app/styles/app.css deleted file mode 100644 index 2763afa4c..000000000 --- a/tests/vite-app/app/styles/app.css +++ /dev/null @@ -1 +0,0 @@ -/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */ diff --git a/tests/vite-app/app/templates/application.hbs b/tests/vite-app/app/templates/application.hbs deleted file mode 100644 index d01955f70..000000000 --- a/tests/vite-app/app/templates/application.hbs +++ /dev/null @@ -1,9 +0,0 @@ -{{page-title "ViteApp"}} - - - - - -{{! Feel free to remove this! }} - -{{outlet}} \ No newline at end of file diff --git a/tests/vite-app/babel.config.js b/tests/vite-app/babel.config.js deleted file mode 100644 index 6fc0fc2f4..000000000 --- a/tests/vite-app/babel.config.js +++ /dev/null @@ -1,4 +0,0 @@ -// eslint-disable-next-line n/no-missing-require -let config = require('./node_modules/.embroider/rewritten-app/_babel_config_'); - -module.exports = config; diff --git a/tests/vite-app/config/ember-cli-update.json b/tests/vite-app/config/ember-cli-update.json deleted file mode 100644 index df142922c..000000000 --- a/tests/vite-app/config/ember-cli-update.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "schemaVersion": "1.0.0", - "packages": [ - { - "name": "ember-cli", - "version": "5.0.0", - "blueprints": [ - { - "name": "app", - "outputRepo": "https://github.com/ember-cli/ember-new-output", - "codemodsSource": "ember-app-codemods-manifest@1", - "isBaseBlueprint": true, - "options": [ - "--ci-provider=github" - ] - } - ] - } - ] -} diff --git a/tests/vite-app/config/environment.js b/tests/vite-app/config/environment.js deleted file mode 100644 index 81d93ebd9..000000000 --- a/tests/vite-app/config/environment.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -module.exports = function (environment) { - const ENV = { - modulePrefix: 'vite-app', - environment, - rootURL: '/', - locationType: 'history', - EmberENV: { - EXTEND_PROTOTYPES: false, - FEATURES: { - // Here you can enable experimental features on an ember canary build - // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true - }, - }, - - APP: { - // Here you can pass flags/options to your application instance - // when it is created - }, - }; - - if (environment === 'development') { - // ENV.APP.LOG_RESOLVER = true; - // ENV.APP.LOG_ACTIVE_GENERATION = true; - // ENV.APP.LOG_TRANSITIONS = true; - // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; - // ENV.APP.LOG_VIEW_LOOKUPS = true; - } - - if (environment === 'test') { - // Testem prefers this... - ENV.locationType = 'none'; - - // keep test console output quieter - ENV.APP.LOG_ACTIVE_GENERATION = false; - ENV.APP.LOG_VIEW_LOOKUPS = false; - - ENV.APP.rootElement = '#ember-testing'; - ENV.APP.autoboot = false; - } - - if (environment === 'production') { - // here you can enable a production-specific feature - } - - return ENV; -}; diff --git a/tests/vite-app/config/optional-features.json b/tests/vite-app/config/optional-features.json deleted file mode 100644 index b26286e2e..000000000 --- a/tests/vite-app/config/optional-features.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "application-template-wrapper": false, - "default-async-observers": true, - "jquery-integration": false, - "template-only-glimmer-components": true -} diff --git a/tests/vite-app/config/targets.js b/tests/vite-app/config/targets.js deleted file mode 100644 index 1e48e0599..000000000 --- a/tests/vite-app/config/targets.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const browsers = [ - 'last 1 Chrome versions', - 'last 1 Firefox versions', - 'last 1 Safari versions', -]; - -module.exports = { - browsers, -}; diff --git a/tests/vite-app/ember-cli-build.js b/tests/vite-app/ember-cli-build.js deleted file mode 100644 index 9b9de5318..000000000 --- a/tests/vite-app/ember-cli-build.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -const EmberApp = require('ember-cli/lib/broccoli/ember-app'); -const { prebuild } = require('@embroider/compat'); - -module.exports = function (defaults) { - const app = new EmberApp(defaults, { - // Add options here - }); - - return prebuild(app); -}; diff --git a/tests/vite-app/package.json b/tests/vite-app/package.json deleted file mode 100644 index b3493f391..000000000 --- a/tests/vite-app/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "vite-app", - "version": "0.0.0", - "private": true, - "description": "Small description for vite-app goes here", - "repository": "", - "license": "MIT", - "author": "", - "directories": { - "doc": "doc", - "test": "tests" - }, - "scripts": { - "build": "vite build", - "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", - "lint:css": "stylelint \"**/*.css\"", - "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", - "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", - "lint:hbs": "ember-template-lint .", - "lint:hbs:fix": "ember-template-lint . --fix", - "lint:js": "eslint . --cache", - "lint:js:fix": "eslint . --fix", - "start": "vite", - "start:test": "vite --open /tests/", - "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", - "test:ember": "node ./scripts/run-tests.mjs" - }, - "devDependencies": { - "@babel/core": "^7.23.6", - "@babel/eslint-parser": "^7.22.5", - "@babel/plugin-proposal-decorators": "^7.23.6", - "@ember/optional-features": "^2.0.0", - "@ember/string": "^3.1.1", - "@ember/test-helpers": "^3.0.3", - "@embroider/compat": "workspace:*", - "@embroider/core": "workspace:*", - "@embroider/vite": "workspace:*", - "@glimmer/component": "^1.1.2", - "@glimmer/tracking": "^1.1.2", - "@rollup/plugin-babel": "^5.3.1", - "broccoli-asset-rev": "^3.0.0", - "concurrently": "^8.2.0", - "ember-auto-import": "^2.6.3", - "ember-cli": "~5.0.0", - "ember-cli-app-version": "^6.0.0", - "ember-cli-babel": "^8.2.0", - "ember-cli-clean-css": "^2.0.0", - "ember-cli-dependency-checker": "^3.3.1", - "ember-cli-htmlbars": "^6.2.0", - "ember-cli-inject-live-reload": "^2.1.0", - "ember-cli-sri": "^2.1.1", - "ember-cli-terser": "^4.0.2", - "ember-load-initializers": "^2.1.2", - "ember-modifier": "^4.1.0", - "ember-page-title": "^7.0.0", - "ember-qunit": "^7.0.0", - "ember-resolver": "^10.1.0", - "ember-source": "5.7.0-beta.1", - "ember-template-lint": "^5.10.3", - "ember-welcome-page": "^7.0.2", - "eslint": "^8.42.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-ember": "^11.8.0", - "eslint-plugin-n": "^16.0.0", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-qunit": "^7.3.4", - "js-reporters": "^2.1.0", - "loader.js": "^4.7.0", - "prettier": "^2.8.8", - "puppeteer-chromium-resolver": "^21.0.0", - "qunit": "^2.19.4", - "qunit-dom": "^2.0.0", - "stylelint": "^15.7.0", - "stylelint-config-standard": "^33.0.0", - "stylelint-prettier": "^3.0.0", - "tracked-built-ins": "^3.1.1", - "typescript": "^5.1.6", - "vite": "^5.0.9" - }, - "engines": { - "node": "16.* || >= 18" - }, - "ember": { - "edition": "octane" - } -} diff --git a/tests/vite-app/public/robots.txt b/tests/vite-app/public/robots.txt deleted file mode 100644 index f5916452e..000000000 --- a/tests/vite-app/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# http://www.robotstxt.org -User-agent: * -Disallow: diff --git a/tests/vite-app/scripts/run-tests.mjs b/tests/vite-app/scripts/run-tests.mjs deleted file mode 100644 index 72ace7e45..000000000 --- a/tests/vite-app/scripts/run-tests.mjs +++ /dev/null @@ -1,87 +0,0 @@ -import child from "child_process"; -import { resolve } from "path"; -import PCR from "puppeteer-chromium-resolver"; - -const __root = process.cwd(); - -async function run() { - // eslint-disable-next-line new-cap - const { puppeteer, executablePath } = await PCR({}); - console.log("[ci] starting"); - - await /** @type {Promise} */ ( - new Promise((fulfill) => { - const runvite = child.fork( - resolve(__root, "node_modules", "vite", "bin", "vite.js"), - ["--port", "60173", "--no-open"], - { - stdio: "pipe", - } - ); - - process.on("exit", () => runvite.kill()); - - runvite.stderr.on("data", (data) => { - console.log("stderr", String(data)); - }); - - runvite.stdout.on("data", (data) => { - const chunk = String(data); - console.log("stdout", chunk); - if (chunk.includes("Local") && chunk.includes("60173")) { - fulfill(1); - } - }); - - console.log("[ci] spawning"); - }) - ); - - console.log("[ci] spawned"); - - const browser = await puppeteer.launch({ - headless: "new", - executablePath, - args: ["--no-sandbox", "--disable-setuid-sandbox"], - }); - - console.log("[ci] puppeteer launched"); - - const result = await /** @type {Promise} */ ( - // eslint-disable-next-line no-async-promise-executor - new Promise(async (fulfill) => { - const page = await browser.newPage(); - - page.on("pageerror", (msg) => { - console.error(msg); - fulfill(1); - }); - - page.on("console", (msg) => { - const text = msg.text(); - const location = msg.location(); - if (text.includes("HARNESS")) { - try { - const parsed = JSON.parse(text); - if (parsed.type === "[HARNESS] done") { - return fulfill(parsed.failed > 0 ? 1 : 0); - } - } catch (e) {} - } - if (location.url?.includes(`/qunit.js`)) { - console.log(text); - } else { - console.debug(text); - } - }); - - await page.goto("http://localhost:60173/tests/?hidepassed&ci"); - }) - ); - - await browser.close(); - - process.exit(result); -} - -run(); diff --git a/tests/vite-app/testem.js b/tests/vite-app/testem.js deleted file mode 100644 index ed2f37124..000000000 --- a/tests/vite-app/testem.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -module.exports = { - test_page: 'tests/index.html?hidepassed', - disable_watching: true, - launch_in_ci: ['Chrome'], - launch_in_dev: ['Chrome'], - browser_start_timeout: 120, - browser_args: { - Chrome: { - ci: [ - // --no-sandbox is needed when running Chrome inside a container - process.env.CI ? '--no-sandbox' : null, - '--headless', - '--disable-dev-shm-usage', - '--disable-software-rasterizer', - '--mute-audio', - '--remote-debugging-port=0', - '--window-size=1440,900', - ].filter(Boolean), - }, - }, -}; diff --git a/tests/vite-app/tests/acceptance/app-route-test.js b/tests/vite-app/tests/acceptance/app-route-test.js deleted file mode 100644 index 223c7a36f..000000000 --- a/tests/vite-app/tests/acceptance/app-route-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { visit } from '@ember/test-helpers'; -import { setupApplicationTest } from 'vite-app/tests/helpers'; - -module('Acceptance | app route', function (hooks) { - setupApplicationTest(hooks); - - test('visiting /', async function (assert) { - await visit('/'); - assert.dom().includesText('hey'); - }); -}); diff --git a/tests/vite-app/tests/helpers/index.js b/tests/vite-app/tests/helpers/index.js deleted file mode 100644 index 7f70de80f..000000000 --- a/tests/vite-app/tests/helpers/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { - setupApplicationTest as upstreamSetupApplicationTest, - setupRenderingTest as upstreamSetupRenderingTest, - setupTest as upstreamSetupTest, -} from 'ember-qunit'; - -// This file exists to provide wrappers around ember-qunit's / ember-mocha's -// test setup functions. This way, you can easily extend the setup that is -// needed per test type. - -function setupApplicationTest(hooks, options) { - upstreamSetupApplicationTest(hooks, options); - - // Additional setup for application tests can be done here. - // - // For example, if you need an authenticated session for each - // application test, you could do: - // - // hooks.beforeEach(async function () { - // await authenticateSession(); // ember-simple-auth - // }); - // - // This is also a good place to call test setup functions coming - // from other addons: - // - // setupIntl(hooks); // ember-intl - // setupMirage(hooks); // ember-cli-mirage -} - -function setupRenderingTest(hooks, options) { - upstreamSetupRenderingTest(hooks, options); - - // Additional setup for rendering tests can be done here. -} - -function setupTest(hooks, options) { - upstreamSetupTest(hooks, options); - - // Additional setup for unit tests can be done here. -} - -export { setupApplicationTest, setupRenderingTest, setupTest }; diff --git a/tests/vite-app/tests/index.html b/tests/vite-app/tests/index.html deleted file mode 100644 index 04048d969..000000000 --- a/tests/vite-app/tests/index.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - ViteApp Tests - - - - {{content-for "head"}} - {{content-for "test-head"}} - - - - - - {{content-for "head-footer"}} - {{content-for "test-head-footer"}} - - - {{content-for "body"}} - {{content-for "test-body"}} - -
-
-
-
-
-
- - - - - - - - {{content-for "body-footer"}} - {{content-for "test-body-footer"}} - - diff --git a/tests/vite-app/tests/integration/.gitkeep b/tests/vite-app/tests/integration/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/tests/integration/example-test.js b/tests/vite-app/tests/integration/example-test.js deleted file mode 100644 index 5a4ea1416..000000000 --- a/tests/vite-app/tests/integration/example-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, rerender } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | Example', (hooks) => { - setupRenderingTest(hooks); - - test('should have Yay for gts!', async function (assert) { - await render(hbs` - - `); - await rerender(); - assert.dom().includesText('Yay for gts!'); - }); -}); diff --git a/tests/vite-app/tests/integration/fany-test-gjs.gjs b/tests/vite-app/tests/integration/fany-test-gjs.gjs deleted file mode 100644 index 1b0d74019..000000000 --- a/tests/vite-app/tests/integration/fany-test-gjs.gjs +++ /dev/null @@ -1,22 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, click, rerender, settled } from '@ember/test-helpers'; -import Fancy from 'vite-app/components/fancy2'; - - -module('Integration | Component | Fany -- from gjs test file', (hooks) => { - setupRenderingTest(hooks); - - test('should have Yay for gts!', async function(assert) { - await render(); - await rerender() - - assert.dom().hasText('Yay for gjs!'); - }); -}); - - - - diff --git a/tests/vite-app/tests/integration/fany-test.gts b/tests/vite-app/tests/integration/fany-test.gts deleted file mode 100644 index 5924d73ef..000000000 --- a/tests/vite-app/tests/integration/fany-test.gts +++ /dev/null @@ -1,22 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, rerender } from '@ember/test-helpers'; -import Fancy from 'vite-app/components/fancy'; - - -module('Integration | Component | Fany -- from gts test file', (hooks) => { - setupRenderingTest(hooks); - - test('should have Yay for gts!', async function(assert) { - await render(); - await rerender() - - assert.dom().hasText('Yay for gts!'); - }); -}); - - - - diff --git a/tests/vite-app/tests/integration/fany2-test.js b/tests/vite-app/tests/integration/fany2-test.js deleted file mode 100644 index 2c0850499..000000000 --- a/tests/vite-app/tests/integration/fany2-test.js +++ /dev/null @@ -1,19 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, rerender } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | Fany2', (hooks) => { - setupRenderingTest(hooks); - - test('should have Yay for gjs!', async function (assert) { - await render(hbs` - - - `); - await rerender(); - - assert.dom().includesText('Yay for gts!'); - assert.dom().includesText('Yay for gjs!'); - }); -}); diff --git a/tests/vite-app/tests/setup-harness.js b/tests/vite-app/tests/setup-harness.js deleted file mode 100644 index 8ab6502b7..000000000 --- a/tests/vite-app/tests/setup-harness.js +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable no-console */ -import { autoRegister } from 'js-reporters'; -import qunit from 'qunit'; - -export function setupQunit() { - if (hasFlag('ci')) { - const runner = autoRegister(); - const tap = qunit.reporters.tap; - tap.init(runner, { log: console.info }); - - QUnit.config.urlConfig.push({ - id: 'smoke_tests', - label: 'Enable Smoke Tests', - tooltip: 'Enable Smoke Tests', - }); - - QUnit.config.urlConfig.push({ - id: 'ci', - label: 'Enable CI Mode', - tooltip: - 'CI mode makes tests run faster by sacrificing UI responsiveness', - }); - - console.log(`[HARNESS] ci=${hasFlag('ci')}`); - } - - qunit.done((details) => { - console.log(JSON.stringify({ ...details, type: '[HARNESS] done' })); - }); -} - -function hasFlag(flag) { - let location = typeof window !== 'undefined' && window.location; - return location && new RegExp(`[?&]${flag}`).test(location.search); -} diff --git a/tests/vite-app/tests/test-helper.js b/tests/vite-app/tests/test-helper.js deleted file mode 100644 index 65f966a46..000000000 --- a/tests/vite-app/tests/test-helper.js +++ /dev/null @@ -1,15 +0,0 @@ -import Application from 'vite-app/app'; -import config from 'vite-app/config/environment'; -import * as QUnit from 'qunit'; -import { setApplication } from '@ember/test-helpers'; -import { setup } from 'qunit-dom'; -import { start } from 'ember-qunit'; -import { setupQunit } from './setup-harness'; - -setApplication(Application.create(config.APP)); - -setup(QUnit.assert); - -setupQunit(); - -start(); diff --git a/tests/vite-app/tests/unit/.gitkeep b/tests/vite-app/tests/unit/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/vite-app/vite.config.mjs b/tests/vite-app/vite.config.mjs deleted file mode 100644 index bca7b9d9e..000000000 --- a/tests/vite-app/vite.config.mjs +++ /dev/null @@ -1,64 +0,0 @@ -import { defineConfig } from "vite"; -import { - resolver, - hbs, - scripts, - templateTag, - optimizeDeps, - compatPrebuild, - assets, -} from "@embroider/vite"; -import { resolve } from "path"; -import { babel } from "@rollup/plugin-babel"; - -const root = "node_modules/.embroider/rewritten-app"; - -export default defineConfig(({ mode }) => { - return { - root, - // esbuild in vite does not support decorators - esbuild: false, - cacheDir: resolve("node_modules", ".vite"), - plugins: [ - hbs(), - templateTag(), - scripts(), - resolver(), - compatPrebuild(), - assets(), - - babel({ - babelHelpers: "runtime", - - // this needs .hbs because our hbs() plugin above converts them to - // javascript but the javascript still also needs babel, but we don't want - // to rename them because vite isn't great about knowing how to hot-reload - // them if we resolve them to made-up names. - extensions: [".gjs", ".js", ".hbs", ".ts", ".gts"], - }), - ], - optimizeDeps: optimizeDeps(), - server: { - port: 4200, - watch: { - ignored: ["!**/node_modules/.embroider/rewritten-app/**"], - }, - }, - publicDir: resolve(process.cwd(), "public"), - build: { - outDir: resolve(process.cwd(), "dist"), - rollupOptions: { - input: { - main: resolve(root, "index.html"), - ...(shouldBuildTests(mode) - ? { tests: resolve(root, "tests/index.html") } - : undefined), - }, - }, - }, - }; -}); - -function shouldBuildTests(mode) { - return mode !== "production" || process.env.FORCE_BUILD_TESTS; -}