vite build.rollupOptions.input
custom entries not loaded in cypress
#28606
Answered
by
knownasilya
knownasilya
asked this question in
Questions and Help
-
export default defineConfig({
build: {
rollupOptions: {
input: {
main: fileURLToPath(new URL('./index.html', import.meta.url)),
checklist: fileURLToPath(
new URL('./iframe-checklist.html', import.meta.url)
),
// .. Test looks like so: describe('Checklist', () => {
beforeEach(() => {
cy.stubCommonRoutes();
cy.intercept('GET', '**/checklist_items', {
fixture: 'checklist/checklist.json',
}).as('getChecklist');
cy.intercept('GET', '**/tasks*', {fixture: 'checklist/tasks.json'}).as(
'getTasks'
);
});
it('can see checklist items in /iframe-checklist', () => {
cy.visit('/iframe-checklist.html?targetType=task&targetId=35941037');
cy.wait(['@getChecklist', '@getTasks']);
cy.get('.checklist-name').should('have.text', 'Not Complete');
cy.get('.checklist-content .checklist-item').should('have.length', 2);
cy.percySnapshot();
});
}); the test hasn't changed, just migrated from webpack to vite. Note that the tests that are on 'main' work just fine.EDIT: looks like I needed to tighten my globs for the fixtures since vite now serves a bunch more files and some matched the fixture glob. Changed it to this.
Now I get |
Beta Was this translation helpful? Give feedback.
Answered by
knownasilya
Dec 28, 2023
Replies: 1 comment
-
Looks like ultimately I needed better glob patterns for matching api fixtures, since vite served a bunch more files. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
knownasilya
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like ultimately I needed better glob patterns for matching api fixtures, since vite served a bunch more files.
Also my non-main scripts needed
import 'whatwg-fetch';