Skip to content

chore: minor build tweaks and cleaning #56

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

Merged
merged 5 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = {
'simple-import-sort'
],
rules: {
'max-len': ['warn', {'code': 100}]
'max-len': ['warn', {'code': 100}],
"simple-import-sort/sort": "error"
},
overrides: [
{
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
],
"scripts": {
"toc": "doctoc README.md",
"lint": "eslint src/**/*.js --fix",
"lint": "eslint src --fix",
"clean": "rimraf dist",
"build": "npm run clean && babel src --out-dir dist --ignore '**/__tests__/**'",
"test": "jest src/__tests__ ",
"test": "jest src",
"test:watch": "npm run test -- --watch",
"test:update": "npm run test -- --updateSnapshot --coverage",
"setup": "npm install && npm run validate",
Expand Down Expand Up @@ -125,8 +125,9 @@
"^.+\\.svelte$": "jest-transform-svelte",
"^.+\\.html$": "svelte-test/transform"
},
"transformIgnorePatterns": [
"/node_modules/(?!svelte).+\\.js$"
"moduleFileExtensions": [
"js",
"svelte"
]
}
}
4 changes: 2 additions & 2 deletions src/__tests__/act.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render as stlRender, fireEvent, act } from '..'
import Comp from './fixtures/Comp.svelte'
import { act, fireEvent, render as stlRender } from '..'
import Comp from './fixtures/Comp'

describe('act', () => {
let props
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/auto-cleanup-skip.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Comp from './fixtures/Comp.svelte'
import Comp from './fixtures/Comp'

describe('auto-cleanup-skip', () => {
let render
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/auto-cleanup.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Comp from './fixtures/Comp.svelte'
import { render } from '..'
import Comp from './fixtures/Comp'

describe('auto-cleanup', () => {
// This just verifies that by importing STL in an
Expand Down
5 changes: 3 additions & 2 deletions src/__tests__/debug.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { render } from '..'
import Comp from './fixtures/Comp.svelte'
import { prettyDOM } from '@testing-library/dom'

import { render } from '..'
import Comp from './fixtures/Comp'

describe('debug', () => {
beforeEach(() => {
jest.spyOn(console, 'log').mockImplementation(() => {})
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/events.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fireEvent, render } from '..'
import Comp from './fixtures/Comp.svelte'
import Comp from './fixtures/Comp'

describe('events', () => {
test('state changes are flushed after firing an event', async () => {
Expand Down
6 changes: 1 addition & 5 deletions src/__tests__/fixtures/Comp.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
}
</script>

<style>
h1 {
color: purple;
}
</style>
<style></style>

<h1>Hello {name}!</h1>

Expand Down
13 changes: 6 additions & 7 deletions src/__tests__/fixtures/Stopwatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@

<style></style>

<div>
<span>{lapse}ms</span>
<button on:click={handleRunClick}>
{running ? 'Stop' : 'Start'}
</button>
<button on:click={handleClearClick}>Clear</button>
</div>
<span>{lapse}ms</span>

<button on:click={handleRunClick}>
{running ? 'Stop' : 'Start'}
</button>

<button on:click={handleClearClick}>Clear</button>
2 changes: 1 addition & 1 deletion src/__tests__/multi-base.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '..'
import Comp from './fixtures/Comp.svelte'
import Comp from './fixtures/Comp'

describe('multi-base', () => {
let treeA
Expand Down
7 changes: 3 additions & 4 deletions src/__tests__/render.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {
render as stlRender,
act
act,
render as stlRender
} from '..'

import Comp from './fixtures/Comp.svelte'
import Comp from './fixtures/Comp'
import CompDefault from './fixtures/Comp.html'

describe('render', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/rerender.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '..'
import Comp from './fixtures/Comp.svelte'
import Comp from './fixtures/Comp'

describe('rerender', () => {
test('mounts new component successfully', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/unmount.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, fireEvent, act } from '..'
import Stopwatch from './fixtures/Stopwatch.svelte'
import { act, fireEvent, render } from '..'
import Stopwatch from './fixtures/Stopwatch'

describe('unmount', () => {
test('unmounts component successfully', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pure.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getQueriesForElement, prettyDOM, fireEvent as dtlFireEvent } from '@testing-library/dom'
import { fireEvent as dtlFireEvent, getQueriesForElement, prettyDOM } from '@testing-library/dom'
import { tick } from 'svelte'

const containerCache = new Map()
Expand Down