ember-cli
ember-cli copied to clipboard
Fresh app 404's on missing assets/test-support.css
Generating a fresh ember 5.5 app results in the following error.
This is likely due to ember-qunit now being a v2 addon (it internally handles it's styles with a JS import). Probably the blueprint needs to have the <link rel="stylesheet" href="{{rootURL}}assets/test-support.css"> import removed?
I was just trying to figure out where this gets built from. I'm pretty sure it's used somehow in ember-a11y-testing as invocations of a11yAudit come with 404s every time looking for this file.
Edit - never mind this comes from axe-core and can be turned off with
//test-helpers.js
import { setRunOptions } from 'ember-a11y-testing/test-support';
setRunOptions({
preload: false,
});
@NullVoxPopuli any thoughts?
It does seem like a bug with ember-cli.
Like, since ember-cli is the convention based build tool, it should probably gracefully fallback to an empty file for test-support.js, and log a message saying that no v1 addons put any content into it
At the same time, if ember-qunit was the only producer of test-support content, i think it's totally legit to just remove the entry from index.html
I don't see this on v5.7.0 or v5.5.0, is there something more specific than a new app to recreate it?
FWIW I've just created an addon following https://github.com/embroider-build/addon-blueprint?tab=readme-ov-file (I wanted to try to migrate my private addon to v2).
I have this error in the console when running the tests:
I don't know what is supposed to create this file, but as @NullVoxPopuli said, I guess I can just remove this file in the index.html
I don't see this on v5.7.0 or v5.5.0, is there something more specific than a new app to recreate it?
I just tried again, simply generating a new app with the latest ember-cli (5.8) through ember new -> ember s -> visit localhost:4200/tests, it'll show an error for the test-support.css file. I think indeed we can simply remove it from the index.html blueprint.
So we've been looking at this area recently because of the Embroider upgrades, and I think the ember-cli behaviour is to not generate a test-support.css file if there are no addons that inject things (via classic addon behaviour). I suspect that this is happening now because there are no longer any addons that inject things into test-support.css, maybe ember-qunit recently changed to a v2 addon?
I don't know that we should just remove it from the blueprint, I think the better solution would be to generate it even when it is going to be empty, what do we think?
So we've been looking at this area recently because of the Embroider upgrades, and I think the ember-cli behaviour is to not generate a test-support.css file if there are no addons that inject things (via classic addon behaviour). I suspect that this is happening now because there are no longer any addons that inject things into test-support.css, maybe ember-qunit recently changed to a v2 addon?
I don't know that we should just remove it from the blueprint, I think the better solution would be to generate it even when it is going to be empty, what do we think?
The only addons I knew of using this were ember-mocha (unsupported/deprecated) and ember-qunit before v2 conversion. Could be that there's others around indeed, so seems better.
I’m currently inserting a custom test stylesheet using app.import() in ember-cli-build.js:
app.import('tests/custom-test-styles.css', { type: 'test' })
When used this way the styles are output in test-support.css for some reason.
How or why? no idea, but thought it might be helpful to be aware of when considering removing it from the blueprint. (I'm currently using Ember v5.10 without embroider.)
We should really deprecate app.import...
@seanCodes The { type: 'test' } is what adds it to that file. Alternatively you could add a style tag to your tests/index.html and reference the file that way.
I just deleted test-support.css from every project in a monorepo.
We should probably remove it from the blueprint at some point