-
Notifications
You must be signed in to change notification settings - Fork 674
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
Implement TypeScript support (closes #408) #1463
Conversation
❌ Tests for the commit 29ee325 have failed. See details: |
❌ Tests for the commit 1c38bdb have failed. See details: |
Compiler._setupSourceMapsSupport(); | ||
} | ||
|
||
static getSupportedTestFileExtensions () { |
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.
We can get extensions once, after compilers' creation
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.
ok, do not mind
src/compiler/test-file/api-based.js
Outdated
|
||
|
||
// Const | ||
APIBasedTestFileCompilerBase.EXPORTABLE_LIB_PATH = join(__dirname, '../../api/exportable-lib'); |
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.
we can use static get
for this
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.
I think declare a const and use static get
will be more in es6 style
|
||
static _reportErrors (diagnostics) { | ||
// NOTE: lazy load the compiler | ||
var ts = require('typescript'); |
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.
may be use get
for ts
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.
forget it)
✅ Tests for the commit 1c38bdb have passed. See details: |
"testcafe-reporter-json": "^2.1.0", | ||
"testcafe-reporter-list": "^2.1.0", | ||
"testcafe-reporter-minimal": "^2.1.0", | ||
"testcafe-reporter-spec": "^2.1.1", | ||
"testcafe-reporter-xunit": "^2.1.0", | ||
"time-limit-promise": "^1.0.2", | ||
"tree-kill": "^1.1.0", | ||
"typescript": "^2.2.2", |
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.
Is it possible to make typescript a peer dependency? Likely many projects are already going to have typescript pulled in as a dependency.
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.
@RichiCoder1 Is there any problem with having ts as dependency? Unlike e.g. babel it has zero dependencies and package size is quite small. Moreover, if you already have ts installed package manager will more likely link already installed version.
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.
True, but it does open yourself up to issues if Typescript releases a major version, and the typescript package is yet another package for end users. That being said, I don't feel strongly about this :)
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.
Yeah, but we'll be open for such issues anyway, i.e. programmatical API that we use could change with a major version bump.
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.
lgtm
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.
:)
❌ Tests for the commit 96a61fc have failed. See details: |
2 similar comments
❌ Tests for the commit 96a61fc have failed. See details: |
❌ Tests for the commit 96a61fc have failed. See details: |
❌ Tests for the commit 5ef519e have failed. See details: |
@testcafe-build-bot \retest |
❌ Tests for the commit 5ef519e have failed. See details: |
The only functional test is failed. It relates to the |
* Introduce TestFileCompilerBase * Refactor compiler dir structure * Extract APIBasedTestFileCompilerBase * Update legacy api * Compiler basics * Exportable lib resolution * Basic test * Mixed deps test * Definitions * More definitions * More definitions * More definitions * More definitions * More definitions * More definitions * Test Selector definitions * More definition tests. * Compilation tests * Functional smoke tests * CLI support * Descriptions * Description * Drop node 10 support * Fix Helen's remarks.
This enables built-in compilation of
.ts
files and type definitions for TestCafe. You need toimport 'testcafe';
(in case if you don't import e.g.Selector
already) to enable typings, editor support and make test files compilable:Note that tagged template literal syntax is not available for
fixture
andpage
. Use function syntax instead.To try code completion and API hints in VSCode run
npm install @inikulin/testcafe
and thenimport '@inikulin/testcafe'
in your test file.\cc @AlexanderMoskovkin @helen-dikareva @AndreyBelym
Note that we've dropped Node 0.10 support with this feature.