Open andrewdc opened 4 years ago
The config in your example exports an object with 3 configs: 'client', 'server' and 'serviceWorker' which confused the Rollup loader. That's why you see the warning
(!) You have passed an unrecognized option
Unknown input options: client, server, serviceworker. Allowed options:
Hmm, I need to think how to better solve this, or maybe someone can come up with an idea.
A workaround would be to factor out the client Rollup config into a separate file and pass its filename like this issue has implemented https://github.com/bahmutov/cy-rollup/issues/2
Or maybe cy-rollup
should handle this scenario, I have opened https://github.com/bahmutov/cy-rollup/issues/23
it's fixed now, you pass a custom config, in which you only gives client section of the build for the tests https://github.com/bahmutov/cy-rollup/issues/2#issuecomment-625458128 Readme should be updated to reflect this change that's important for sapper. (first time even making a comment like this so i don't know how to do the update properly, sorry)
it's fixed now, you pass a custom config, in which you only gives client section of the build for the tests https://github.com/bahmutov/cy-rollup/issues/2#issuecomment-625458128 Readme should be updated to reflect this change that's important for sapper. (first time even making a comment like this so i don't know how to do the update properly, sorry)
Fantastic guys. I will test this out shortly. Thanks so much for putting a fix in for this!
Still having this issue, not sure if the fix works
GET /__/ 200 5.299 ms - -
GET /__cypress/runner/cypress_runner.css 200 3.177 ms - -
GET /__cypress/runner/cypress_runner.js 200 1.482 ms - -
GET /__cypress/runner/fonts/fa-solid-900.woff2 200 0.654 ms - 76120
GET /__cypress/iframes/component/auth/login_component_spec.js 200 3.109 ms - 929
(!) You have passed an unrecognized option
Unknown input options: client, server, serviceworker. Allowed options: acorn, acornInjectPlugins, cache, context, experimentalCacheExpiry, external, inlineDynamicImports, input, manualChunks, moduleContext, onwarn, perf, plugins, preserveEntrySignatures, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch
We currently have 1 warnings
(!) You have passed an unrecognized option
Unknown input options: client, server, serviceworker. Allowed options: acorn, acornInjectPlugins, cache, context, experimentalCacheExpiry, external, inlineDynamicImports, input, manualChunks, moduleContext, onwarn, perf, plugins, preserveEntrySignatures, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch
We currently have 1 warnings
{
code: 'ERROR',
error: Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
at error (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:5211:30)
at Module.error (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:9726:16)
at tryParse (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:9640:23)
at Module.setSource (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:10037:30)
at ModuleLoader.addModuleSource (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18170:20)
at async ModuleLoader.fetchModule (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18224:9)
at async Promise.all (index 1)
at async ModuleLoader.fetchStaticDependencies (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18248:34)
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18225:9)
at async Promise.all (index 0) {
code: 'PARSE_ERROR',
parserError: SyntaxError: Unexpected token (1:0)
at Object.pp$4.raise (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:15427:13)
at Object.pp.unexpected (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:13119:8)
at Object.pp$3.parseExprAtom (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14826:10)
at Object.pp$3.parseExprSubscripts (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14629:19)
at Object.pp$3.parseMaybeUnary (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14606:17)
at Object.parseMaybeUnary (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:19027:29)
at Object.pp$3.parseExprOps (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14541:19)
at Object.pp$3.parseMaybeConditional (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14524:19)
at Object.pp$3.parseMaybeAssign (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14492:19)
at Object.pp$3.parseExpression (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:14458:19)
at Object.pp$1.parseStatement (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:13307:45)
at Object.pp$1.parseTopLevel (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:13176:21)
at Object.parse (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:12978:15)
at Function.parse (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:12999:35)
at tryParse (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:9627:23)
at Module.setSource (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:10037:30)
at ModuleLoader.addModuleSource (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18170:20)
at async ModuleLoader.fetchModule (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18224:9)
at async Promise.all (index 1)
at async ModuleLoader.fetchStaticDependencies (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18248:34)
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (/Users/kennedyotieno/git/redischat/node_modules/rollup/dist/shared/rollup.js:18225:9) {
pos: 0,
loc: [Position],
raisedAt: 1
},
id: '/Users/kennedyotieno/git/redischat/src/components/auth/Login.svelte',
pos: 0,
loc: {
file: '/Users/kennedyotieno/git/redischat/src/components/auth/Login.svelte',
line: 1,
column: 0
},
frame: '1: <script>\n' +
' ^\n' +
'2: import { goto, stores } from "@sapper/app";\n' +
'3: const { session } = stores();',
watchFiles: [
'/Users/kennedyotieno/git/redischat/src/components/auth/login_component_spec.js',
'/Users/kennedyotieno/git/redischat/src/components/auth/Login.svelte'
]
}
}
GET /__cypress/tests?p=src/components/auth/login_component_spec.js 200 804.803 ms - 111
GET /__cypress/tests?p=cypress/support/index.js 200 808.102 ms - 232
GET /__cypress/iframes/component/auth/login_component_spec.js 304 1.074 ms - -
GET /__cypress/tests?p=src/components/auth/login_component_spec.js 200 1.413 ms - 111
GET /__cypress/tests?p=cypress/support/index.js 200 2.602 ms - 232
GET /service-worker.js 200 32.157 ms - -
GET /client/index.bd9d6bd3.js 200 34.107 ms - -
GET /client/index.27cffd42.js 200 33.616 ms - -
GET /client/[username].c526705f.js 200 31.702 ms - -
GET /client/index.d7059ef4.js 200 30.338 ms - -
GET /client/_layout.e20ffd61.js 200 30.444 ms - -
GET /service-worker-index.html 200 14.711 ms - -
GET /client/index.334d77b8.js 200 24.356 ms - -
GET /client/sapper-dev-client.1e7a4a5e.js 200 22.750 ms - -
GET /client/_layout.474b8281.js 200 28.890 ms - -
GET /client/client.02b8d83d.js 200 23.132 ms - -
GET /__cypress/runner/fonts/fa-regular-400.woff2 200 1.366 ms - 13600
@TheBeachMaster I have the same error, did you find the solution?
@vuonghungvinh I never managed to fix this, and now that Sapper has been deprecated in favor of Svelte Kit try using svelte-testing-library
@TheBeachMaster Thank you
Bug (possibly Sapper related)
mini project here: cy-unti-test-test
Full error output:
I don't have the specialty to totally understand where the problem is here, but my guess is that something in the way Sapper serves up files cannot jive with the way this package imports .svelte files for testing.
Any help welcomed. Thanks in advance! -adc