Skip to content

Unit Testing with ns7 #9346

Open
Open
@mansiTT

Description

@mansiTT

tns : 7.0.6

Describe the bug
We are facing issue in integrating unit testing in our codebase. We have followed steps mentioned in the documentation for integrating the unit test framework.
Ref Doc : https://docs.nativescript.org/development-workflow.html#angular-testbed-integration
Imports mentioned in the docs are not compatible with ns7. It keeps giving error.

We have tried updating the imports

from :
import 'nativescript-angular/zone-js/testing.jasmine'
import { nsTestBedInit } from 'nativescript-angular/testing'
nsTestBedInit()

to :

import '@nativescript/zone-js/testing.jasmine'
import { nsTestBedInit } from '@nativescript/angular/testing'
nsTestBedInit()

Its giving error :

CONSOLE LOG: NSUTR: this.error: ReferenceError: Zone is not defined
at /base/src/tests/setup.bundle.js?23f4da92075f9f283030879ef2e337b8e3487aa3
20 04 2021 14:04:28.882:WARN [NativeScript / 14.1 (14.1; iPhone)]: Adapter did not report total number of specs.
NativeScript / 14.1 (14.1; iPhone): Executed 0 of null SUCCESS (0 secs / 0 secs)
NativeScript / 14.1 (14.1; iPhone) /base/src/tests/setup.bundle.js?23f4da92075f9f283030879ef2e337b8e3487aa3 at line 0 FAILED
ReferenceError: Zone is not defined
NativeScript / 14.1 (14.1; iPhone): Executed 1 of null (1 FAILED) (0.003 secs / 0 secs)
TOTAL: 1 FAILED, 0 SUCCESS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions