This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {kettle} from './02-kettle.mjs' //fails with error | |
| console.log(kettle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {kettle} = require('./kettle.js') // fails with error | |
| console.log(kettle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kettleModule from './kettle.js' // succeeds | |
| console.log(kettleModule.kettle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "dual-cjs-mjs-package", | |
| "version": "1.0.0", | |
| "description": "A package that can be both imported as esm and as cjs", | |
| "main": "entry", | |
| "scripts": { | |
| "build": "babel *.mjs **/*.mjs --out-dir ." | |
| }, | |
| "devDependencies": { | |
| "babel-cli": "^6.26.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "plugins": [ | |
| "transform-es2015-modules-commonjs", "dynamic-import-node" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {kettle} = require('./kettle.mjs') // fails with error | |
| console.log(kettle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe(`TodoMVC using Cypress`, function () { | |
| it('can add todos and then delete them', () => { | |
| // visit the todomvc application | |
| cy.visit('http://todomvc.com/examples/react/#/') | |
| // type a new todo into the "new todo" input field. | |
| cy.get('.new-todo').type('Cook dinner{enter}') | |
| // ensure that a new todo was created correctly | |
| cy.get('.view > label').should('have.text', 'Cook dinner') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const countItemsLeft = cy.contains('item left') | |
| if (countItemsLeft.innerText === '1 items left') { | |
| // do something... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cy.contains('item left') | |
| // do the following code on the element that contains "item left". | |
| .then(countItemsLeft => { | |
| // if the text in the element is "1 items left", log it. | |
| if (countItemsLeft.innerText === '1 items left') { | |
| console.log('lalala!') | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| describe(`TodoMVC using Cypress`, function () { | |
| it('can add todos and then delete them', () => { | |
| cy.visit('http://todomvc.com/examples/react/#/') | |
| cy.get('.new-todo').type('Cook dinner{enter}') | |
| cy.get('.view > label').should('have.text', 'Cook dinner') | |
| cy.get('.new-todo').type('Clean house{enter}').then(() => {debugger}) |