sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
79.75k stars 4.23k forks source link

store/index.js tests don't run on `npm run test` #6330

Closed subtle-byte closed 3 years ago

subtle-byte commented 3 years ago

Describe the bug

test/store/index.js tests don't run on npm run test.

Seems like any non index.ts does not run due to this line in the test/test.ts:

const test_folders = glob('*/index.ts', { cwd: 'test' });

To Reproduce

I've made one test in test/store/index.js always fail and got following result:

Tail of `npm run test` output ```console stats ✓ basic ✓ returns a stats object when options.generate is false validate ✓ a11y-alt-text ✓ a11y-anchor-has-content ✓ a11y-anchor-in-svg-is-valid ✓ a11y-anchor-is-valid ✓ a11y-aria-props ✓ a11y-aria-role ✓ a11y-aria-unsupported-element ✓ a11y-contenteditable-element-without-child ✓ a11y-figcaption-in-non-element-block ✓ a11y-figcaption-right-place ✓ a11y-figcaption-wrong-place ✓ a11y-heading-has-content ✓ a11y-html-has-lang ✓ a11y-iframe-has-title ✓ a11y-img-redundant-alt ✓ a11y-in-foreign-namespace ✓ a11y-label-has-associated-control ✓ a11y-media-has-caption ✓ a11y-no-access-key ✓ a11y-no-autofocus ✓ a11y-no-distracting-elements ✓ a11y-no-onchange ✓ a11y-not-on-components ✓ a11y-scope ✓ a11y-tabindex-no-positive ✓ action-invalid ✓ action-object ✓ action-on-component ✓ animation-duplicate ✓ animation-missing ✓ animation-not-in-each ✓ animation-not-in-keyed-each ✓ animation-siblings ✓ attribute-expected-equals ✓ attribute-invalid-name ✓ attribute-invalid-name-2 ✓ attribute-invalid-name-3 ✓ attribute-invalid-name-4 ✓ attribute-invalid-name-5 ✓ await-component-is-used ✓ await-no-catch ✓ await-shorthand-no-catch ✓ await-shorthand-no-then ✓ binding-await-catch ✓ binding-await-then ✓ binding-await-then-2 ✓ binding-const ✓ binding-const-field ✓ binding-dimensions-svg ✓ binding-dimensions-svg-child ✓ binding-dimensions-void ✓ binding-input-checked ✓ binding-input-type-boolean ✓ binding-input-type-dynamic ✓ binding-invalid ✓ binding-invalid-foreign-namespace ✓ binding-invalid-on-element ✓ binding-invalid-value ✓ binding-invalid-value-global ✓ binding-let ✓ binding-select-multiple-dynamic ✓ catch-declares-error-variable ✓ component-dynamic ✓ component-event-modifiers-invalid ✓ component-name-lowercase ✓ component-namespaced - component-slot-default-duplicate.skip ✓ component-slot-default-reserved ✓ component-slot-dynamic ✓ component-slot-dynamic-attribute - component-slot-named-duplicate.skip ✓ component-slotted-custom-element ✓ component-slotted-custom-element-2 ✓ component-slotted-each-block ✓ component-slotted-if-block ✓ contenteditable-dynamic ✓ contenteditable-missing ✓ css-invalid-global-placement ✓ debug-invalid-args ✓ default-export ✓ directive-non-expression ✓ dollar-dollar-global-in-markup ✓ dollar-dollar-global-in-script ✓ dollar-global-in-markup ✓ dollar-global-in-script ✓ each-block-destructured-object-rest-comma-after ✓ each-block-invalid-context ✓ each-block-invalid-context-destructured ✓ each-block-invalid-context-destructured-object ✓ each-block-multiple-children ✓ empty-block ✓ event-modifiers-invalid ✓ event-modifiers-invalid-nonpassive ✓ event-modifiers-invalid-passive ✓ event-modifiers-legacy ✓ event-modifiers-redundant ✓ ignore-warning ✓ ignore-warnings ✓ ignore-warnings-cumulative ✓ ignore-warnings-newline ✓ ignore-warnings-stacked ✓ import-meta ✓ invalid-empty-css-declaration ✓ missing-component ✓ missing-component-global ✓ missing-custom-element-compile-options ✓ module-script-reactive-declaration ✓ multiple-script-default-context ✓ multiple-script-module-context ✓ namespace-invalid ✓ namespace-invalid-unguessable ✓ namespace-non-literal ✓ non-empty-block-dev ✓ reactive-declaration-cyclical ✓ reactive-declaration-non-top-level ✓ reactive-module-variable ✓ ref-not-supported ✓ ref-not-supported-in-css ✓ script-invalid-context ✓ select-multiple ✓ slot-attribute-invalid ✓ svelte-slot-placement ✓ svelte-slot-placement-2 ✓ svg-child-component-declared-namespace ✓ tag-custom-element-options-missing ✓ tag-custom-element-options-true ✓ tag-invalid ✓ tag-non-string ✓ textarea-value-children ✓ title-no-attributes ✓ title-no-children ✓ transition-duplicate-in ✓ transition-duplicate-in-transition ✓ transition-duplicate-out ✓ transition-duplicate-out-transition ✓ transition-duplicate-transition ✓ transition-duplicate-transition-in ✓ transition-duplicate-transition-out ✓ transition-missing ✓ transition-on-component ✓ undefined-value ✓ undefined-value-global ✓ unreferenced-variables ✓ use-the-platform ✓ window-binding-invalid ✓ window-binding-invalid-innerwidth ✓ window-binding-invalid-value ✓ window-binding-invalid-width ✓ window-binding-online ✓ errors if options.name is illegal ✓ warns if options.name is not capitalised ✓ does not warn if options.name begins with non-alphabetic character ✓ errors if namespace is provided but unrecognised ✓ errors with a hint if namespace is provided but unrecognised but close ✓ does not throw error if 'this' is bound for foreign element vars ✓ $$props, generate: dom ✓ $$props, generate: ssr ✓ $$props, generate: false ✓ $$props-logicless, generate: dom ✓ $$props-logicless, generate: ssr ✓ $$props-logicless, generate: false ✓ actions, generate: dom ✓ actions, generate: ssr ✓ actions, generate: false ✓ animations, generate: dom ✓ animations, generate: ssr ✓ animations, generate: false ✓ assumed-global, generate: dom ✓ assumed-global, generate: ssr ✓ assumed-global, generate: false ✓ component-namespaced, generate: dom ✓ component-namespaced, generate: ssr ✓ component-namespaced, generate: false ✓ duplicate-globals, generate: dom ✓ duplicate-globals, generate: ssr ✓ duplicate-globals, generate: false ✓ duplicate-non-hoistable, generate: dom ✓ duplicate-non-hoistable, generate: ssr ✓ duplicate-non-hoistable, generate: false ✓ duplicate-vars, generate: dom ✓ duplicate-vars, generate: ssr ✓ duplicate-vars, generate: false ✓ implicit-reactive, generate: dom ✓ implicit-reactive, generate: ssr ✓ implicit-reactive, generate: false ✓ imports, generate: dom ✓ imports, generate: ssr ✓ imports, generate: false ✓ modules-vars, generate: dom ✓ modules-vars, generate: ssr ✓ modules-vars, generate: false ✓ mutated-vs-reassigned, generate: dom ✓ mutated-vs-reassigned, generate: ssr ✓ mutated-vs-reassigned, generate: false ✓ mutated-vs-reassigned-bindings, generate: dom ✓ mutated-vs-reassigned-bindings, generate: ssr ✓ mutated-vs-reassigned-bindings, generate: false ✓ props, generate: dom (46ms) ✓ props, generate: ssr ✓ props, generate: false ✓ referenced-from-script, generate: dom ✓ referenced-from-script, generate: ssr ✓ referenced-from-script, generate: false ✓ store-referenced, generate: dom ✓ store-referenced, generate: ssr ✓ store-referenced, generate: false ✓ store-unreferenced, generate: dom ✓ store-unreferenced, generate: ssr ✓ store-unreferenced, generate: false ✓ template-references, generate: dom ✓ template-references, generate: ssr ✓ template-references, generate: false ✓ transitions, generate: dom ✓ transitions, generate: ssr ✓ transitions, generate: false ✓ undeclared, generate: dom ✓ undeclared, generate: ssr ✓ undeclared, generate: false 3332 passing (1m) 24 pending > svelte@3.38.2 posttest > agadoo internal/index.mjs Success! internal/index.mjs is fully tree-shakeable ```

Then I've replaced the line with const test_folders = glob('*/index.{js,ts}', { cwd: 'test' }); in test/test.ts and got following result:

Tail of `npm run test` output ```console stats ✓ basic ✓ returns a stats object when options.generate is false store writable 1) creates a writable store ✓ calls provided subscribe handler ✓ does not assume immutable data ✓ only calls subscriber once initially, including on resubscriptions readable ✓ creates a readable store derived ✓ maps a single store ✓ maps multiple stores ✓ passes optional set function ✓ prevents glitches ✓ prevents diamond dependency problem ✓ derived dependency does not update and shared ancestor updates ✓ is updated with safe_not_equal logic ✓ calls a cleanup function ✓ discards non-function return values ✓ allows derived with different types ✓ works with RxJS-style observables get ✓ gets the current value of a store ✓ works with RxJS-style observables validate ✓ a11y-alt-text ✓ a11y-anchor-has-content ✓ a11y-anchor-in-svg-is-valid ✓ a11y-anchor-is-valid ✓ a11y-aria-props ✓ a11y-aria-role ✓ a11y-aria-unsupported-element ✓ a11y-contenteditable-element-without-child ✓ a11y-figcaption-in-non-element-block ✓ a11y-figcaption-right-place ✓ a11y-figcaption-wrong-place ✓ a11y-heading-has-content ✓ a11y-html-has-lang ✓ a11y-iframe-has-title ✓ a11y-img-redundant-alt ✓ a11y-in-foreign-namespace ✓ a11y-label-has-associated-control ✓ a11y-media-has-caption ✓ a11y-no-access-key ✓ a11y-no-autofocus ✓ a11y-no-distracting-elements ✓ a11y-no-onchange ✓ a11y-not-on-components ✓ a11y-scope ✓ a11y-tabindex-no-positive ✓ action-invalid ✓ action-object ✓ action-on-component ✓ animation-duplicate ✓ animation-missing ✓ animation-not-in-each ✓ animation-not-in-keyed-each ✓ animation-siblings ✓ attribute-expected-equals ✓ attribute-invalid-name ✓ attribute-invalid-name-2 ✓ attribute-invalid-name-3 ✓ attribute-invalid-name-4 ✓ attribute-invalid-name-5 ✓ await-component-is-used ✓ await-no-catch ✓ await-shorthand-no-catch ✓ await-shorthand-no-then ✓ binding-await-catch ✓ binding-await-then ✓ binding-await-then-2 ✓ binding-const ✓ binding-const-field ✓ binding-dimensions-svg ✓ binding-dimensions-svg-child ✓ binding-dimensions-void ✓ binding-input-checked ✓ binding-input-type-boolean ✓ binding-input-type-dynamic ✓ binding-invalid ✓ binding-invalid-foreign-namespace ✓ binding-invalid-on-element ✓ binding-invalid-value ✓ binding-invalid-value-global ✓ binding-let ✓ binding-select-multiple-dynamic ✓ catch-declares-error-variable ✓ component-dynamic ✓ component-event-modifiers-invalid ✓ component-name-lowercase ✓ component-namespaced - component-slot-default-duplicate.skip ✓ component-slot-default-reserved ✓ component-slot-dynamic ✓ component-slot-dynamic-attribute - component-slot-named-duplicate.skip ✓ component-slotted-custom-element ✓ component-slotted-custom-element-2 ✓ component-slotted-each-block ✓ component-slotted-if-block ✓ contenteditable-dynamic ✓ contenteditable-missing ✓ css-invalid-global-placement ✓ debug-invalid-args ✓ default-export ✓ directive-non-expression ✓ dollar-dollar-global-in-markup ✓ dollar-dollar-global-in-script ✓ dollar-global-in-markup ✓ dollar-global-in-script ✓ each-block-destructured-object-rest-comma-after ✓ each-block-invalid-context ✓ each-block-invalid-context-destructured ✓ each-block-invalid-context-destructured-object ✓ each-block-multiple-children ✓ empty-block ✓ event-modifiers-invalid ✓ event-modifiers-invalid-nonpassive ✓ event-modifiers-invalid-passive ✓ event-modifiers-legacy ✓ event-modifiers-redundant ✓ ignore-warning ✓ ignore-warnings ✓ ignore-warnings-cumulative ✓ ignore-warnings-newline ✓ ignore-warnings-stacked ✓ import-meta ✓ invalid-empty-css-declaration ✓ missing-component ✓ missing-component-global ✓ missing-custom-element-compile-options ✓ module-script-reactive-declaration ✓ multiple-script-default-context ✓ multiple-script-module-context ✓ namespace-invalid ✓ namespace-invalid-unguessable ✓ namespace-non-literal ✓ non-empty-block-dev ✓ reactive-declaration-cyclical ✓ reactive-declaration-non-top-level ✓ reactive-module-variable ✓ ref-not-supported ✓ ref-not-supported-in-css ✓ script-invalid-context ✓ select-multiple ✓ slot-attribute-invalid ✓ svelte-slot-placement ✓ svelte-slot-placement-2 ✓ svg-child-component-declared-namespace ✓ tag-custom-element-options-missing ✓ tag-custom-element-options-true ✓ tag-invalid ✓ tag-non-string ✓ textarea-value-children ✓ title-no-attributes ✓ title-no-children ✓ transition-duplicate-in ✓ transition-duplicate-in-transition ✓ transition-duplicate-out ✓ transition-duplicate-out-transition ✓ transition-duplicate-transition ✓ transition-duplicate-transition-in ✓ transition-duplicate-transition-out ✓ transition-missing ✓ transition-on-component ✓ undefined-value ✓ undefined-value-global ✓ unreferenced-variables ✓ use-the-platform ✓ window-binding-invalid ✓ window-binding-invalid-innerwidth ✓ window-binding-invalid-value ✓ window-binding-invalid-width ✓ window-binding-online ✓ errors if options.name is illegal ✓ warns if options.name is not capitalised ✓ does not warn if options.name begins with non-alphabetic character ✓ errors if namespace is provided but unrecognised ✓ errors with a hint if namespace is provided but unrecognised but close ✓ does not throw error if 'this' is bound for foreign element vars ✓ $$props, generate: dom ✓ $$props, generate: ssr ✓ $$props, generate: false ✓ $$props-logicless, generate: dom ✓ $$props-logicless, generate: ssr ✓ $$props-logicless, generate: false ✓ actions, generate: dom ✓ actions, generate: ssr ✓ actions, generate: false ✓ animations, generate: dom ✓ animations, generate: ssr ✓ animations, generate: false ✓ assumed-global, generate: dom ✓ assumed-global, generate: ssr ✓ assumed-global, generate: false ✓ component-namespaced, generate: dom ✓ component-namespaced, generate: ssr ✓ component-namespaced, generate: false ✓ duplicate-globals, generate: dom ✓ duplicate-globals, generate: ssr ✓ duplicate-globals, generate: false ✓ duplicate-non-hoistable, generate: dom ✓ duplicate-non-hoistable, generate: ssr ✓ duplicate-non-hoistable, generate: false ✓ duplicate-vars, generate: dom ✓ duplicate-vars, generate: ssr ✓ duplicate-vars, generate: false ✓ implicit-reactive, generate: dom ✓ implicit-reactive, generate: ssr ✓ implicit-reactive, generate: false ✓ imports, generate: dom ✓ imports, generate: ssr ✓ imports, generate: false ✓ modules-vars, generate: dom ✓ modules-vars, generate: ssr ✓ modules-vars, generate: false ✓ mutated-vs-reassigned, generate: dom ✓ mutated-vs-reassigned, generate: ssr ✓ mutated-vs-reassigned, generate: false ✓ mutated-vs-reassigned-bindings, generate: dom ✓ mutated-vs-reassigned-bindings, generate: ssr ✓ mutated-vs-reassigned-bindings, generate: false ✓ props, generate: dom (46ms) ✓ props, generate: ssr ✓ props, generate: false ✓ referenced-from-script, generate: dom ✓ referenced-from-script, generate: ssr ✓ referenced-from-script, generate: false ✓ store-referenced, generate: dom ✓ store-referenced, generate: ssr ✓ store-referenced, generate: false ✓ store-unreferenced, generate: dom ✓ store-unreferenced, generate: ssr ✓ store-unreferenced, generate: false ✓ template-references, generate: dom ✓ template-references, generate: ssr ✓ template-references, generate: false ✓ transitions, generate: dom (41ms) ✓ transitions, generate: ssr ✓ transitions, generate: false ✓ undeclared, generate: dom ✓ undeclared, generate: ssr ✓ undeclared, generate: false 3349 passing (2m) 24 pending 1 failing 1) store writable creates a writable store: AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal: [ 0, 1, 2 ] should loosely deep-equal 0 at Context. (test/store/index.js:22:11) at processImmediate (node:internal/timers:464:21) ```

Pay attention now there is store section after stats and before validate.

Expected behavior

All tests run on npm run test.

subtle-byte commented 3 years ago

Fixed by #6293