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
test: ensure integration tests can fail, add vue-sfc #768
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
root: true | ||
|
||
parser: 'vue-eslint-parser' | ||
|
||
env: | ||
es6: true | ||
node: true | ||
|
||
parserOptions: | ||
# Local version of @typescript-eslint/parser | ||
parser: '@typescript-eslint/parser' | ||
project: /usr/linked/tsconfig.json | ||
sourceType: module | ||
extraFileExtensions: ['.vue'] | ||
|
||
plugins: | ||
# Local version of @typescript-eslint/eslint-plugin | ||
- '@typescript-eslint' | ||
|
||
rules: | ||
'@typescript-eslint/no-explicit-any': 'error' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM node:carbon | ||
|
||
# Copy the test.sh into the container. Every other file will be linked, rather | ||
# than copied to allow for changes without rebuilds wherever possible | ||
WORKDIR /usr | ||
COPY ./test.sh /usr/ | ||
|
||
# Create file which will be executed by jest | ||
# to assert that the lint output is what we expect | ||
RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ | ||
"\n" \ | ||
"test('it should produce the expected lint ouput', () => {\n" \ | ||
" expect(actualLintOutput).toMatchSnapshot();\n" \ | ||
"});\n" > test.js | ||
|
||
# Run the integration test | ||
CMD [ "./test.sh" ] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- Hello.vue --> | ||
<template> | ||
<div> | ||
<div> | ||
<!-- !!!!! expected error !!!!! --> | ||
Hello {{ (name as any) }}{{exclamationMarks}} | ||
</div> | ||
<button @click="decrement">-</button> | ||
<button @click="increment">+</button> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from "vue"; | ||
export default Vue.extend({ | ||
props: ['name', 'initialEnthusiasm'], | ||
data() { | ||
return { | ||
enthusiasm: this.initialEnthusiasm, | ||
} | ||
}, | ||
methods: { | ||
increment() { this.enthusiasm++; }, | ||
decrement() { | ||
if (this.enthusiasm > 1) { | ||
this.enthusiasm--; | ||
} | ||
}, | ||
}, | ||
computed: { | ||
exclamationMarks(): any { // !!!!! expected error !!!!! | ||
return Array(this.enthusiasm + 1).join('!'); | ||
} | ||
} | ||
}); | ||
</script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`it should produce the expected lint ouput 1`] = ` | ||
Array [ | ||
Object { | ||
"errorCount": 1, | ||
"filePath": "/usr/linked/Hello.vue", | ||
"fixableErrorCount": 0, | ||
"fixableWarningCount": 0, | ||
"messages": Array [ | ||
Object { | ||
"column": 29, | ||
"endColumn": 32, | ||
"endLine": 31, | ||
"line": 31, | ||
"message": "Unexpected any. Specify a different type.", | ||
"messageId": "unexpectedAny", | ||
"nodeType": "TSAnyKeyword", | ||
"ruleId": "@typescript-eslint/no-explicit-any", | ||
"severity": 2, | ||
}, | ||
], | ||
"source": "<!-- Hello.vue --> | ||
<template> | ||
<div> | ||
<div> | ||
<!-- !!!!! expected error !!!!! --> | ||
Hello {{ (name as any) }}{{exclamationMarks}} | ||
</div> | ||
<button @click=\\"decrement\\">-</button> | ||
<button @click=\\"increment\\">+</button> | ||
</div> | ||
</template> | ||
|
||
<script lang=\\"ts\\"> | ||
import Vue from \\"vue\\"; | ||
export default Vue.extend({ | ||
props: ['name', 'initialEnthusiasm'], | ||
data() { | ||
return { | ||
enthusiasm: this.initialEnthusiasm, | ||
} | ||
}, | ||
methods: { | ||
increment() { this.enthusiasm++; }, | ||
decrement() { | ||
if (this.enthusiasm > 1) { | ||
this.enthusiasm--; | ||
} | ||
}, | ||
}, | ||
computed: { | ||
exclamationMarks(): any { // !!!!! expected error !!!!! | ||
return Array(this.enthusiasm + 1).join('!'); | ||
} | ||
} | ||
}); | ||
</script> | ||
", | ||
"warningCount": 0, | ||
}, | ||
] | ||
`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Generate the package.json to use | ||
node /usr/utils/generate-package-json.js | ||
|
||
# Install dependencies | ||
npm install | ||
|
||
# Use the local volumes for our own packages | ||
npm install $(npm pack /usr/typescript-estree | tail -1) | ||
npm install $(npm pack /usr/parser | tail -1) | ||
npm install $(npm pack /usr/eslint-plugin | tail -1) | ||
|
||
# Install the latest vue-eslint-parser (this may break us occassionally, but it's probably good to get that feedback early) | ||
npm install vue-eslint-parser@latest | ||
|
||
# Run the linting | ||
# (the "|| true" helps make sure that we run our tests on failed linting runs as well) | ||
npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.vue || true | ||
|
||
# Run our assertions against the linting output | ||
npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Ensure child script failures are propagated | ||
set -e | ||
|
||
# We run the services serially and in a non-detached state just that we can ensure predictable | ||
# exit codes for all of our integration tests, and we can ensure CI builds pass or fail appropriately | ||
|
||
# typescript-and-tslint-plugins-together | ||
docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit typescript-and-tslint-plugins-together | ||
|
||
# vue-sfc | ||
docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-sfc |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trailing ` on the message was accidentally added at some point, I will remove it once I have confirmed that the integration tests fail appropriately