Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smoke-tests for types, build, etc #9633

Merged
merged 14 commits into from
Jan 29, 2025
Prev Previous commit
Next Next commit
Revert changes to vite-basic-compat
NullVoxPopuli committed Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 11f67112ccb3ac017ba03dab2e3d244bf48b3eeb
12 changes: 1 addition & 11 deletions tests/vite-basic-compat/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -3,18 +3,8 @@
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { maybeEmbroider } = require('@embroider/test-setup');

module.exports = async function (defaults) {
const { setConfig } = await import('@warp-drive/build-config');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {});

/**
* TODO: find another way to set this config,
* because the most modern of apps will not have a compat build
*/
setConfig(app, __dirname, {
compatWith: process.env.EMBER_DATA_FULL_COMPAT ? '99.0' : null,
});

return maybeEmbroider(app);
};
6 changes: 0 additions & 6 deletions tests/vite-basic-compat/package.json
Original file line number Diff line number Diff line change
@@ -50,9 +50,6 @@
"@ember-data/json-api": {
"injected": true
},
"@ember-data/rest": {
"injected": true
},
"@ember-data/request-utils": {
"injected": true
},
@@ -84,7 +81,6 @@
"@ember-data/json-api": "workspace:*",
"@ember-data/legacy-compat": "workspace:*",
"@ember-data/model": "workspace:*",
"@ember-data/rest": "workspace:*",
"@ember-data/request": "workspace:*",
"@ember-data/request-utils": "workspace:*",
"@ember-data/serializer": "workspace:*",
@@ -102,7 +98,6 @@
"@embroider/vite": "0.2.2-unstable.4070ba7",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@glint/core": "1.5.0",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^3.0.8",
"@types/eslint__js": "^8.42.3",
@@ -136,7 +131,6 @@
"eslint-plugin-n": "^17.13.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-qunit": "^8.1.2",
"expect-type": "^0.20.0",
"globals": "^15.12.0",
"loader.js": "^4.7.0",
"pnpm-sync-dependencies-meta-injected": "0.0.14",
23 changes: 23 additions & 0 deletions tests/vite-basic-compat/tests/acceptance/visit-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { visit } from '@ember/test-helpers';

import { module, test } from 'qunit';

import { setupApplicationTest } from 'ember-qunit';

module('it works', function (hooks) {
setupApplicationTest(hooks);

test('we can boot the app', async function (assert) {
await visit('/');
assert.ok('it works!');
});

test('we can use the store', async function (assert) {
const { owner } = this;
const store = owner.lookup('service:store');

const record = store.createRecord('user', { name: 'Chris' });

assert.strictEqual(record.name, 'Chris', 'correct name');
});
});
43 changes: 43 additions & 0 deletions tests/vite-basic-compat/tests/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
setupApplicationTest as upstreamSetupApplicationTest,
setupRenderingTest as upstreamSetupRenderingTest,
setupTest as upstreamSetupTest,
type SetupTestOptions,
} from 'ember-qunit';

// This file exists to provide wrappers around ember-qunit's
// test setup functions. This way, you can easily extend the setup that is
// needed per test type.

function setupApplicationTest(hooks: NestedHooks, options?: SetupTestOptions) {
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, 'en-us'); // ember-intl
// setupMirage(hooks); // ember-cli-mirage
}

function setupRenderingTest(hooks: NestedHooks, options?: SetupTestOptions) {
upstreamSetupRenderingTest(hooks, options);

// Additional setup for rendering tests can be done here.
}

function setupTest(hooks: NestedHooks, options?: SetupTestOptions) {
upstreamSetupTest(hooks, options);

// Additional setup for unit tests can be done here.
}

export { setupApplicationTest, setupRenderingTest, setupTest };
Empty file.
Empty file.