Skip to content

Commit

Permalink
feat(build): upgrade deps & cjs to esm (#5927)
Browse files Browse the repository at this point in the history
* feat(build): upgrade deps & cjs to esm

* fix: lock

* fix(test): migrate cypress to v10

* fix(deps): codelyzer

* fix(deps): deps

* chore: lint

* fix: tests

Co-authored-by: Vladimir Kharlampidi <[email protected]>
  • Loading branch information
vltansky and nolimits4web authored Sep 6, 2022
1 parent a2bcbb1 commit 921809b
Show file tree
Hide file tree
Showing 44 changed files with 13,467 additions and 4,812 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const rules = {
'no-underscore-dangle': 'off',
'prefer-object-spread': 'off',
'prefer-destructuring': 'off',
'default-param-last': 'off',
'import/prefer-default-export': 'off',
'guard-for-in': 'off',
'no-restricted-syntax': 'off',
Expand Down Expand Up @@ -70,5 +71,16 @@ module.exports = {
'import/extensions': [2, 'ignorePackages', { js: 'always' }],
},
},
{
files: ['scripts/**/*.*'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
...rules,
'import/extensions': [2, 'ignorePackages', { js: 'always' }],
},
},
],
};
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@babel/preset-env", { "modules": false, "loose": true }]]
}
8 changes: 8 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'cypress';

export default defineConfig({
video: false,
e2e: {
setupNodeEvents(on, config) {},
},
});
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ context('Core', () => {
cy.initSwiper();
cy.getSlides().should('not.have.class', 'swiper-slide-prev');
cy.reinitSwiper({
initialSlide: 1,
initialSlide: 2,
});
cy.getSlide(0).should('have.class', 'swiper-slide-prev');
cy.getSlide(1).should('have.class', 'swiper-slide-prev');
});

it('slidesPerView', () => {
Expand Down Expand Up @@ -308,8 +308,9 @@ context('Core', () => {
allowSlidePrev: false,
});
cy.swipeLeft();
cy.swipeLeft();
cy.swipeRight();
cy.getSlide(3).expectToBeActiveSlide();
cy.getSlide(4).expectToBeActiveSlide();
});

it('direction horizontal', () => {
Expand Down
File renamed without changes.
File renamed without changes.
22 changes: 0 additions & 22 deletions cypress/plugins/index.js

This file was deleted.

16 changes: 5 additions & 11 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Cypress.Commands.add('getSlide', { prevSubject: 'optional' }, (subject, slideInd
});

Cypress.Commands.add('getSlideContains', { prevSubject: 'optional' }, (subject, content) => {
cy.get('.swiper').contains(content);
return cy.get('.swiper-slide').contains(content);
});
Cypress.Commands.add('getSlides', { prevSubject: 'optional' }, () => {
return cy.get(`.swiper-slide`);
Expand Down Expand Up @@ -136,16 +136,10 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add(
'reinitSwiper',
{ prevSubject: 'optional' },
(subject, config = {}, options) => {
return cy.window().then((_window) => {
_window.swiperRef.destroy();
cy.initSwiper(config, options);
});
},
);
Cypress.Commands.add('reinitSwiper', { prevSubject: 'optional' }, (subject, config = {}) => {
cy.reload();
cy.initSwiper(config);
});

Cypress.Commands.add('injectStyles', { prevSubject: 'optional' }, (subject, cssStyles = ``) => {
return cy.document().then((_document) => {
Expand Down
File renamed without changes.
Loading

0 comments on commit 921809b

Please sign in to comment.