Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue: Cleanup Vue Code #2131

Closed
wants to merge 7 commits into from
Closed

Vue: Cleanup Vue Code #2131

wants to merge 7 commits into from

Conversation

ErikCH
Copy link
Contributor

@ErikCH ErikCH commented Jun 17, 2022

Description of changes

  • Moved from Jest to Vitest for Vue testing

  • Added in JSX - For future tests or primitives

  • Fixed issue with Code Editor error Default export of the module has or is using private name in any script setup file that has an interface

Issue #, if available

#2027

Description of how you validated changes

Test passed

Checklist

  • PR description included
  • yarn test passes
  • Tests are updated
  • No side effects or sideEffects field updated
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ErikCH ErikCH requested a review from a team as a code owner June 17, 2022 16:14
@changeset-bot
Copy link

changeset-bot bot commented Jun 17, 2022

🦋 Changeset detected

Latest commit: 4b35b10

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/ui-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -5,7 +5,7 @@
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"declaration": true,
"declaration": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the issue with script setup and having an interface in it, and getting an error message.

import { defineConfig } from 'vite';
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import typescript2 from 'rollup-plugin-typescript2';
import Components from 'unplugin-vue-components/vite';
import vueJsx from '@vitejs/plugin-vue-jsx';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use JSX in our tests now, or in our components if needed.

"babel-jest": "^26.3.1",
"c8": "^7.11.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what vitest uses for code coverage.

@ErikCH ErikCH temporarily deployed to ci June 17, 2022 16:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 17, 2022 16:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 17, 2022 16:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 17, 2022 16:39 Inactive
@@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils';
import { Authenticator } from '../dist';
import crypto from 'crypto';

// This is needed for jest to get crypto module needed by nanoid
// This is needed for vitest to get crypto module needed by nanoid
Object.defineProperty(global.self, 'crypto', {
value: {
getRandomValues: (arr: Array<any>) => crypto.randomBytes(arr.length),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been seeing

image

(and this is on me bc I wrote the code)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if this polyfill is still needed, and if so, can you try more scoped type for Array<any>?

Copy link
Contributor Author

@ErikCH ErikCH Jun 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can update that so GH does not complain

Copy link
Contributor Author

@ErikCH ErikCH Jun 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK fixed. 4b35b10

@ErikCH ErikCH requested a review from wlee221 June 20, 2022 13:29
@ErikCH ErikCH temporarily deployed to ci June 20, 2022 13:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 20, 2022 13:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 20, 2022 13:39 Inactive
@ErikCH ErikCH temporarily deployed to ci June 20, 2022 13:39 Inactive
Copy link
Contributor

@wlee221 wlee221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ErikCH
Copy link
Contributor Author

ErikCH commented Jun 23, 2022

Closed for #2184

@ErikCH ErikCH closed this Jun 23, 2022
@wlee221 wlee221 deleted the vue-cleanup-ee branch June 22, 2023 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants