Skip to content

Commit

Permalink
Place nodetest back into main addon directory
Browse files Browse the repository at this point in the history
The node tests for the blueprints make use of ember-cli-blueprint-test-helpers.
Unfortunatly, this addon requires the tests to be in the same package as the blueprint files.

For more information see: ember-cli/ember-cli-blueprint-test-helpers#56
  • Loading branch information
SanderKnauff committed Jan 15, 2024
1 parent bfb7710 commit 9b2ab17
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 44 deletions.
7 changes: 7 additions & 0 deletions addon/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = {
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/**/*.js',
'./node-tests/**/*.js',
],
parserOptions: {
sourceType: 'script',
Expand All @@ -66,5 +67,11 @@ module.exports = {
},
extends: ['plugin:n/recommended'],
},
{
files: ['node-tests/**/*.js'],
env: {
mocha: true,
},
},
],
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-env node, mocha */
'use strict';

const fs = require('fs');
const path = require('path');

// eslint-disable-next-line n/no-unpublished-require
const blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers');
const setupTestHooks = blueprintHelpers.setupTestHooks;
const emberNew = blueprintHelpers.emberNew;
Expand All @@ -12,8 +12,10 @@ const modifyPackages = blueprintHelpers.modifyPackages;

const BuildConfigEditor = require('ember-cli-build-config-editor');

// eslint-disable-next-line n/no-unpublished-require
const chai = require('ember-cli-blueprint-test-helpers/chai');
const file = chai.file;
// eslint-disable-next-line n/no-unpublished-require
const chaiThings = require('chai-things');
const expect = chai.expect;

Expand Down Expand Up @@ -120,6 +122,7 @@ describe('Acceptance: ember generate ember-bootstrap', function () {
});

describe('install dependencies and configuration', function () {
// eslint-disable-next-line n/no-unpublished-require
let Blueprint = require('ember-cli/lib/models/blueprint');
let origTaskFor = Blueprint.prototype.taskFor;
let installed = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const addonIndex = require('../../addon/index');
const addonIndex = require('../index');
// eslint-disable-next-line n/no-unpublished-require
const expect = require('chai').expect;

describe('index', function () {
Expand Down
14 changes: 12 additions & 2 deletions addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix"
"lint:js:fix": "eslint . --fix",
"nodetest": "mocha node-tests --recursive"
},
"dependencies": {
"@ember/render-modifiers": "^2.0.0",
Expand Down Expand Up @@ -57,7 +58,12 @@
"devDependencies": {
"@babel/eslint-parser": "7.23.3",
"@babel/plugin-proposal-decorators": "7.23.7",
"chai": "4.4.1",
"chai-things": "0.2.0",
"concurrently": "8.2.2",
"ember-cli": "5.5.0",
"ember-cli-blueprint-test-helpers": "0.19.2",
"ember-cli-build-config-editor": "^0.5.1",
"ember-template-lint": "5.13.0",
"ember-template-lint-plugin-prettier": "5.0.0",
"eslint": "8.56.0",
Expand All @@ -66,13 +72,17 @@
"eslint-plugin-hbs": "1.0.3",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-qunit": "8.0.1"
"eslint-plugin-qunit": "8.0.1",
"mocha": "10.2.0"
},
"peerDependencies": {
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"ember-source": ">=4.8.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": "18.* || >= 20"
},
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"private": true,
"scripts": {
"prepare": "husky install",
"test": "pnpm --filter 'test-app' test",
"test:ember": "pnpm --filter 'test-app' test:ember"
"test": "concurrently \"npm:test:*\"",
"test:ember": "pnpm --filter test-app test:ember",
"test:node": "pnpm --filter ember-bootstrap nodetest"
},
"devDependencies": {
"concurrently": "^8.2.2",
"husky": "8.0.3",
"lint-staged": "15.2.0"
},
Expand All @@ -21,9 +23,6 @@
"internal": "Internal"
}
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"release-it": {
"plugins": {
"@release-it-plugins/lerna-changelog": {
Expand Down
33 changes: 18 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions test-app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,5 @@ module.exports = {
// 'plugin:qunit/recommended'
],
},
{
files: ['node-tests/**/*.js'],
env: {
mocha: true,
},
},
],
};
11 changes: 0 additions & 11 deletions test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"nodetest": "mocha node-tests --recursive",
"start": "ember serve",
"testa": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test",
Expand All @@ -44,7 +43,6 @@
"chalk": "^4.1.1",
"ember-auto-import": "^2.6.3",
"ember-cli-babel": "^8.0.0",
"ember-cli-build-config-editor": "^0.5.1",
"ember-cli-htmlbars": "^6.2.0",
"ember-cli-version-checker": "^5.1.2",
"ember-concurrency": "^2.1.2 || ^3.0.0",
Expand Down Expand Up @@ -73,14 +71,11 @@
"@release-it-plugins/lerna-changelog": "6.0.0",
"bootstrap": "5.3.2",
"broccoli-asset-rev": "3.0.0",
"chai": "4.4.1",
"chai-things": "0.2.0",
"concurrently": "8.2.2",
"ember-a11y-testing": "6.1.1",
"ember-bootstrap": "workspace:*",
"ember-cli": "5.5.0",
"ember-cli-app-version": "6.0.1",
"ember-cli-blueprint-test-helpers": "0.19.2",
"ember-cli-content-security-policy": "2.0.3",
"ember-cli-dependency-checker": "3.3.2",
"ember-cli-fastboot": "4.1.2",
Expand Down Expand Up @@ -111,7 +106,6 @@
"eslint-plugin-qunit": "8.0.1",
"findup-sync": "^5.0.0",
"loader.js": "4.7.0",
"mocha": "10.2.0",
"prettier": "3.0.3",
"qunit": "2.20.0",
"qunit-dom": "3.0.0",
Expand All @@ -120,11 +114,6 @@
"tracked-toolbox": "^1.2.3 || ^2.0.0",
"webpack": "5.89.0"
},
"peerDependencies": {
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"ember-source": ">=4.8.0"
},
"engines": {
"node": "18.* || >= 20"
},
Expand Down
6 changes: 3 additions & 3 deletions test-app/testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: ['Chrome'],
launch_in_dev: ['Chrome'],
launch_in_ci: ['Edge'],
launch_in_dev: ['Edge'],
browser_start_timeout: 120,
browser_args: {
Chrome: {
Edge: {
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? '--no-sandbox' : null,
Expand Down

0 comments on commit 9b2ab17

Please sign in to comment.