Skip to content

Commit

Permalink
Merge pull request #53 from danestves/fix/fetch-for-test
Browse files Browse the repository at this point in the history
test: using fetch only for test files
  • Loading branch information
danestves authored Apr 3, 2022
2 parents ed82d97 + 7848e93 commit 29808cb
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 74 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"c8": "^7.11.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"isomorphic-fetch": "^3.0.0",
"jsdom": "^19.0.0",
"lerna": "^4.0.0",
"npm-run-all": "^4.1.5",
Expand Down
8 changes: 2 additions & 6 deletions packages/react/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"env": {
"browser": true,
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
Expand Down
1 change: 1 addition & 0 deletions packages/react/__tests__/vimeo-lite.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dependencies
import { render } from '@testing-library/react';
import 'isomorphic-fetch';

// Internals
import { VimeoLite } from '../src';
Expand Down
1 change: 1 addition & 0 deletions packages/react/__tests__/youtube-lite.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dependencies
import { render } from '@testing-library/react';
import 'isomorphic-fetch';

// Internals
import { YoutubeLite } from '../src';
Expand Down
3 changes: 1 addition & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"devDependencies": {
"@testing-library/react": "^12.1.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
"node-fetch": "^3.2.3"
"eslint-plugin-react": "^7.29.4"
},
"peerDependencies": {
"react": "^16 || ^17 || ^18"
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Dependencies
import type * as React from 'react';
import type * as Stitches from '@stitches/react';

export interface IframeProps extends React.ComponentPropsWithoutRef<'iframe'> {
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/coverage
/dist
/dist
/src/types/*
7 changes: 2 additions & 5 deletions packages/utils/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
"env": {
"browser": true,
"es2021": true,
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"extends": ["eslint:recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 13,
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"test": "vitest run"
},
"dependencies": {
"browser-monads-ts": "^2.0.1",
"node-fetch": "^3.2.3"
"browser-monads-ts": "^2.0.1"
},
"devDependencies": {
"happy-dom": "^2.52.0"
Expand Down
3 changes: 0 additions & 3 deletions packages/utils/src/get-vimeo-poster-url.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Dependencies
import fetch from 'node-fetch';

// Internals
import canUseWebP from './can-use-webp';

Expand Down
12 changes: 8 additions & 4 deletions packages/vue/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"env": {
"browser": true,
"node": true
"es2021": true,
"node": true,
"vue/setup-compiler-macros": true
},
"extends": [
"plugin:vue/vue3-essential",
"plugin:vue/vue3-recommended",
"eslint:recommended",
"@vue/typescript/recommended",
"plugin:prettier/recommended"
"prettier"
],
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 2020
"ecmaVersion": 2021,
"parser": "@typescript-eslint/parser"
},
"plugins": ["vuejs-accessibility"],
"rules": {
Expand Down
1 change: 1 addition & 0 deletions packages/vue/__tests__/vimeo-lite.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dependencies
import { render, waitFor } from '@testing-library/vue';
import 'isomorphic-fetch';

// Internals
import { VimeoLite } from '../src';
Expand Down
1 change: 1 addition & 0 deletions packages/vue/__tests__/youtube-lite.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dependencies
import { render, waitFor } from '@testing-library/vue';
import 'isomorphic-fetch';

// Internals
import { YoutubeLite } from '../src';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<script setup lang="ts">
// Dependencies
import { defineProps } from 'vue';
defineProps({
backgroundImage: {
type: String,
Expand Down
3 changes: 0 additions & 3 deletions packages/vue/src/components/aspect-ratio/aspect-ratio.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<script setup lang="ts">
// Dependencies
import { defineProps } from 'vue';
defineProps({
aspectRatio: {
type: [Number, String],
Expand Down
7 changes: 4 additions & 3 deletions packages/vue/src/components/vimeo-lite/vimeo-lite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getVimeoPosterUrl,
warmVimeoConnections,
} from '@lite-embed/utils';
import { defineProps, onMounted, ref } from 'vue';
import { onMounted, ref } from 'vue';
import type * as Vimeo from 'vimeo__player';
import type { PropType } from 'vue';
Expand Down Expand Up @@ -35,6 +35,7 @@ let props = defineProps({
},
customThumbnail: {
type: String,
default: '',
required: false,
},
playerParameters: {
Expand Down Expand Up @@ -96,8 +97,8 @@ onMounted(() => {
<template>
<aspect-ratio
:aspect-ratio="aspectRatio"
v-on:pointerover="warmConnections"
v-on:click="addIframe"
@pointerover="warmConnections"
@click="addIframe"
>
<aspect-ratio-item :background-image="`url(${posterUrl})`">
<iframe
Expand Down
7 changes: 4 additions & 3 deletions packages/vue/src/components/youtube-lite/youtube-lite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getYoutubePlayerOptions,
warmYoutubeConnections,
} from '@lite-embed/utils';
import { defineProps, ref } from 'vue';
import { ref } from 'vue';
import type * as Youtube from 'youtube-player/dist/types';
import type { PropType } from 'vue';
Expand Down Expand Up @@ -38,6 +38,7 @@ let props = defineProps({
},
customThumbnail: {
type: String,
default: '',
required: false,
},
noCookie: {
Expand Down Expand Up @@ -107,9 +108,9 @@ const addIframe = () => {
<template>
<aspect-ratio
:aspect-ratio="aspectRatio"
v-on:click="addIframe"
v-on:pointerover="warmConnections"
data-testid
@click="addIframe"
@pointerover="warmConnections"
>
<aspect-ratio-item :background-image="`url(${posterUrl})`">
<iframe
Expand Down
52 changes: 13 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2570,11 +2570,6 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"

data-uri-to-buffer@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz"
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==

data-urls@^3.0.1:
version "3.0.1"
resolved "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz"
Expand Down Expand Up @@ -3399,14 +3394,6 @@ fastq@^1.6.0:
dependencies:
reusify "^1.0.4"

fetch-blob@^3.1.2, fetch-blob@^3.1.4:
version "3.1.5"
resolved "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.5.tgz"
integrity sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg==
dependencies:
node-domexception "^1.0.0"
web-streams-polyfill "^3.0.3"

figures@^3.0.0:
version "3.2.0"
resolved "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz"
Expand Down Expand Up @@ -3509,13 +3496,6 @@ form-data@~2.3.2:
combined-stream "^1.0.6"
mime-types "^2.1.12"

formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz"
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
dependencies:
fetch-blob "^3.1.2"

fs-extra@^9.1.0:
version "9.1.0"
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz"
Expand Down Expand Up @@ -4265,6 +4245,14 @@ isobject@^3.0.1:
resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

isomorphic-fetch@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
dependencies:
node-fetch "^2.6.1"
whatwg-fetch "^3.4.1"

isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
Expand Down Expand Up @@ -4954,27 +4942,13 @@ nice-try@^1.0.4:
resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==

node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz"
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==

node-fetch@^2.6.1, node-fetch@^2.6.7, node-fetch@^2.x.x:
version "2.6.7"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

node-fetch@^3.2.3:
version "3.2.3"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.3.tgz"
integrity sha512-AXP18u4pidSZ1xYXRDPY/8jdv3RAozIt/WLNR/MBGZAz+xjtlr90RvCnsvHQRiXyWliZF/CpytExp32UU67/SA==
dependencies:
data-uri-to-buffer "^4.0.0"
fetch-blob "^3.1.4"
formdata-polyfill "^4.0.10"

node-gyp@^5.0.2:
version "5.1.1"
resolved "https://registry.npmjs.org/node-gyp/-/node-gyp-5.1.1.tgz"
Expand Down Expand Up @@ -7049,11 +7023,6 @@ wcwidth@^1.0.0:
dependencies:
defaults "^1.0.3"

web-streams-polyfill@^3.0.3:
version "3.2.0"
resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz"
integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
Expand All @@ -7076,6 +7045,11 @@ whatwg-encoding@^2.0.0:
dependencies:
iconv-lite "0.6.3"

whatwg-fetch@^3.4.1:
version "3.6.2"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==

whatwg-mimetype@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz"
Expand Down

0 comments on commit 29808cb

Please sign in to comment.