Skip to content
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

webdev throws error after I added a test under the test/ directory #2027

Closed
vsmenon opened this issue Feb 7, 2019 · 3 comments
Closed

webdev throws error after I added a test under the test/ directory #2027

vsmenon opened this issue Feb 7, 2019 · 3 comments

Comments

@vsmenon
Copy link
Member

vsmenon commented Feb 7, 2019

From @renatoathaydes on February 6, 2019 17:40

  • Dart SDK Version (dart --version)

Dart VM version: 2.1.0 (Unknown timestamp) on "linux_x64"

  • Whether you are using Windows, MacOSX, or Linux (if applicable)

Linux Ubuntu


I've got a simple web project started with stagehand web-simple.

I had some dart files in the web folder, and decided to write some tests, so I put my test under test/model_test.dart.

The target of the test is a file under web/model.dart, so I have this import on the test file:

import '../web/model.dart';

I can run this test fine from the IDE and also with:

pub run test

But now, when I run webdev serve an error occurs:

Creating build script, took 7156ms
[INFO] Setting up file watchers completed, took 11ms
[INFO] Waiting for all file watchers to be ready completed, took 80ms
[INFO] Reading cached asset graph completed, took 259ms
[INFO] Checking for updates since last build completed, took 600ms
[INFO] Running build completed, took 153ms
[INFO] Caching finalized dependency graph completed, took 128ms
[SEVERE] build_web_compilers|ddc on test/model_test.dartdevc.module (cached):
Error compiling dartdevc module:webdart_example|test/model_test.ddc.js

We're sorry, you've found a bug in our compiler.
You can report this bug at:
    https://github.com/dart-lang/sdk/issues/labels/area-dev-compiler
Please include the information below in your report, along with
any other information that may help us track it down. Thanks!
    dartdevc arguments: --dart-sdk-summary=/usr/lib/dart/lib/_internal/ddc_sdk.sum --modules=amd -o test/model_test.ddc.js --module-root=. --library-root=/test --summary-extension=dartdevc.linked.sum --no-summarize --options=packages/build_modules/src/analysis_options.default.yaml --source-map --source-map-comment --inline-source-map -s web/main.dartdevc.linked.sum -s packages/collection/src/utils.dartdevc.linked.sum -s packages/collection/src/algorithms.dartdevc.linked.sum -s packages/collection/src/canonicalized_map.dartdevc.linked.sum -s packages/collection/src/comparators.dartdevc.linked.sum -s packages/collection/src/iterable_zip.dartdevc.linked.sum -s packages/collection/src/priority_queue.dartdevc.linked.sum -s packages/collection/collection.dartdevc.linked.sum -s packages/async/async.dartdevc.linked.sum -s packages/path/path.dartdevc.linked.sum -s packages/stream_channel/stream_channel.dartdevc.linked.sum -s packages/meta/meta.dartdevc.linked.sum -s packages/stack_trace/stack_trace.dartdevc.linked.sum -s packages/matcher/src/core_matchers.dartdevc.linked.sum -s packages/matcher/matcher.dartdevc.linked.sum -s packages/charcode/ascii.dartdevc.linked.sum -s packages/charcode/html_entity.dartdevc.linked.sum -s packages/charcode/charcode.dartdevc.linked.sum -s packages/term_glyph/term_glyph.dartdevc.linked.sum -s packages/source_span/source_span.dartdevc.linked.sum -s packages/string_scanner/string_scanner.dartdevc.linked.sum -s packages/boolean_selector/boolean_selector.dartdevc.linked.sum -s packages/pedantic/pedantic.dartdevc.linked.sum -s packages/test_api/test_api.dartdevc.linked.sum -s packages/pool/pool.dartdevc.linked.sum -s packages/test_api/src/util/iterable_set.dartdevc.linked.sum -s packages/test_core/test_core.dartdevc.linked.sum -s packages/test/test.dartdevc.linked.sum --url-mapping=file:///test/model_test.dart,test/model_test.dart file:///test/model_test.dart
    dart --version: 2.1.0 (Unknown timestamp) on "linux_x64"

Invalid library root. /test/ does not contain /web/model.dart
#0 jsLibraryName (package:dev_compiler/src/analyzer/code_generator.dart:6396:5)
#1 CodeGenerator.emitLibraryName. (package:dev_compiler/src/analyzer/code_generator.dart:6153:34)
#2 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
#3 CodeGenerator.emitLibraryName (package:dev_compiler/src/analyzer/code_generator.dart:6152:18)
#4 CodeGenerator._emitTopLevelNameNoInterop (package:dev_compiler/src/analyzer/code_generator.dart:3352:9)
#5 CodeGenerator._emitType (package:dev_compiler/src/analyzer/code_generator.dart:3331:12)
#6 CodeGenerator._emitConstructorAccess (package:dev_compiler/src/analyzer/code_generator.dart:3261:44)
#7 CodeGenerator._emitConstructorName (package:dev_compiler/src/analyzer/code_generator.dart:4315:27)
#8 CodeGenerator._emitInstanceCreationExpression.emitNew (package:dev_compiler/src/analyzer/code_generator.dart:4371:18)
#9 CodeGenerator._emitInstanceCreationExpression (package:dev_compiler/src/analyzer/code_generator.dart:4378:51)
#10 CodeGenerator.visitInstanceCreationExpression (package:dev_compiler/src/analyzer/code_generator.dart:4518:12)
#11 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6513:15)
#12 CodeGenerator._visitExpression (package:dev_compiler/src/analyzer/code_generator.dart:5805:18)
#13 CodeGenerator._bindValue (package:dev_compiler/src/analyzer/code_generator.dart:5012:23)
#14 CodeGenerator.visitCascadeExpression (package:dev_compiler/src/analyzer/code_generator.dart:5126:22)
#15 CascadeExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:1426:49)
#16 CodeGenerator._visitExpression (package:dev_compiler/src/analyzer/code_generator.dart:5805:18)
#17 CodeGenerator._emitSetLocal (package:dev_compiler/src/analyzer/code_generator.dart:3534:12)
#18 CodeGenerator._emitSetSimpleIdentifier (package:dev_compiler/src/analyzer/code_generator.dart:3503:14)
#19 CodeGenerator._emitSet (package:dev_compiler/src/analyzer/code_generator.dart:3427:14)
#20 CodeGenerator.visitAssignmentExpression (package:dev_compiler/src/analyzer/code_generator.dart:3368:52)
#21 AssignmentExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:834:49)
#22 CodeGenerator.visitExpressionStatement (package:dev_compiler/src/analyzer/code_generator.dart:4098:23)
#23 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4228:49)
#24 CodeGenerator._visitStatement (package:dev_compiler/src/analyzer/code_generator.dart:5814:18)
#25 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#26 ListIterable.toList (dart:_internal/iterable.dart:219:19)
#27 CodeGenerator._visitStatementList (package:dev_compiler/src/analyzer/code_generator.dart:5821:41)
#28 CodeGenerator.visitBlockFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:3585:21)
#29 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1181:49)
#30 CodeGenerator._emitFunctionScopedBody (package:dev_compiler/src/analyzer/code_generator.dart:2802:22)
#31 CodeGenerator._emitFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:2785:17)
#32 CodeGenerator._emitFunction (package:dev_compiler/src/analyzer/code_generator.dart:2769:11)
#33 CodeGenerator._emitArrowFunction (package:dev_compiler/src/analyzer/code_generator.dart:2724:13)
#34 CodeGenerator.visitFunctionExpression (package:dev_compiler/src/analyzer/code_generator.dart:2717:14)
#35 FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5360:49)
#36 CodeGenerator._visitExpression (package:dev_compiler/src/analyzer/code_generator.dart:5805:18)
#37 CodeGenerator._emitArgumentList (package:dev_compiler/src/analyzer/code_generator.dart:4052:18)
#38 CodeGenerator._emitFunctionCall (package:dev_compiler/src/analyzer/code_generator.dart:3880:16)
#39 CodeGenerator.visitMethodInvocation (package:dev_compiler/src/analyzer/code_generator.dart:3632:14)
#40 MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7827:49)
#41 CodeGenerator.visitExpressionStatement (package:dev_compiler/src/analyzer/code_generator.dart:4098:23)
#42 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4228:49)
#43 CodeGenerator._visitStatement (package:dev_compiler/src/analyzer/code_generator.dart:5814:18)
#44 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#45 ListIterable.toList (dart:_internal/iterable.dart:219:19)
#46 CodeGenerator._visitStatementList (package:dev_compiler/src/analyzer/code_generator.dart:5821:41)
#47 CodeGenerator.visitBlockFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:3585:21)
#48 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1181:49)
#49 CodeGenerator._emitFunctionScopedBody (package:dev_compiler/src/analyzer/code_generator.dart:2802:22)
#50 CodeGenerator._emitFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:2785:17)
#51 CodeGenerator._emitFunction (package:dev_compiler/src/analyzer/code_generator.dart:2769:11)
#52 CodeGenerator._emitArrowFunction (package:dev_compiler/src/analyzer/code_generator.dart:2724:13)
#53 CodeGenerator.visitFunctionExpression (package:dev_compiler/src/analyzer/code_generator.dart:2717:14)
#54 FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5360:49)
#55 CodeGenerator._visitExpression (package:dev_compiler/src/analyzer/code_generator.dart:5805:18)
#56 CodeGenerator._emitArgumentList (package:dev_compiler/src/analyzer/code_generator.dart:4052:18)
#57 CodeGenerator._emitFunctionCall (package:dev_compiler/src/analyzer/code_generator.dart:3880:16)
#58 CodeGenerator.visitMethodInvocation (package:dev_compiler/src/analyzer/code_generator.dart:3632:14)
#59 MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7827:49)
#60 CodeGenerator.visitExpressionStatement (package:dev_compiler/src/analyzer/code_generator.dart:4098:23)
#61 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4228:49)
#62 CodeGenerator._visitStatement (package:dev_compiler/src/analyzer/code_generator.dart:5814:18)
#63 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#64 ListIterable.toList (dart:_internal/iterable.dart:219:19)
#65 CodeGenerator._visitStatementList (package:dev_compiler/src/analyzer/code_generator.dart:5821:41)
#66 CodeGenerator.visitBlockFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:3585:21)
#67 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1181:49)
#68 CodeGenerator._emitFunctionScopedBody (package:dev_compiler/src/analyzer/code_generator.dart:2802:22)
#69 CodeGenerator._emitFunctionBody (package:dev_compiler/src/analyzer/code_generator.dart:2785:17)
#70 CodeGenerator._emitFunction (package:dev_compiler/src/analyzer/code_generator.dart:2769:11)
#71 CodeGenerator._emitFunctionExpression (package:dev_compiler/src/analyzer/code_generator.dart:2749:12)
#72 CodeGenerator.visitFunctionDeclaration (package:dev_compiler/src/analyzer/code_generator.dart:2611:14)
#73 FunctionDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:5197:49)
#74 CodeGenerator.visitCompilationUnit (package:dev_compiler/src/analyzer/code_generator.dart:602:30)
#75 List.forEach (dart:core/runtime/libarray.dart:82:8)
#76 CodeGenerator.compile (package:dev_compiler/src/analyzer/code_generator.dart:335:22)
#77 compileWithAnalyzer (package:dev_compiler/src/analyzer/module_compiler.dart:109:33)
#78 _compile (package:dev_compiler/src/analyzer/command.dart:151:16)
#79 compile (package:dev_compiler/src/analyzer/command.dart:56:18)
#80 compile (package:dev_compiler/src/compiler/shared_command.dart:360:18)
#81 _CompilerWorker.performRequest. (file:///tmp/tmpqIBfjJ/dart-2.1.0/dart/pkg/dev_compiler/bin/dartdevc.dart:50:36)
#82 _rootRun (dart:async/zone.dart:1124:13)
#83 _CustomZone.run (dart:async/zone.dart:1021:19)
#84 _runZoned (dart:async/zone.dart:1516:10)
#85 runZoned (dart:async/zone.dart:1463:12)
#86 _CompilerWorker.performRequest (file:///tmp/tmpqIBfjJ/dart-2.1.0/dart/pkg/dev_compiler/bin/dartdevc.dart:50:21)

#87 AsyncWorkerLoop.run. (package:bazel_worker/src/worker/async_worker_loop.dart:33:41)
#88 _rootRun (dart:async/zone.dart:1124:13)
#89 _CustomZone.run (dart:async/zone.dart:1021:19)
#90 _runZoned (dart:async/zone.dart:1516:10)
#91 runZoned (dart:async/zone.dart:1463:12)
#92 AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:33:26)

#93 main (file:///tmp/tmpqIBfjJ/dart-2.1.0/dart/pkg/dev_compiler/bin/dartdevc.dart:28:57)

#94 _startIsolate. (dart:isolate/runtime/libisolate_patch.dart:285:32)
#95 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

}

[SEVERE] build_web_compilers|entrypoint on test/model_test.dart (cached):

AssetNotFoundException: webdart_example|test/model_test.ddc.js
[SEVERE] Failed after 296ms
Serving `web` on http://localhost:8080
Serving `test` on http://localhost:8081
[INFO] Terminating. No further builds will be scheduled
[INFO] Builds finished. Safe to exit

Copied from original issue: dart-lang/sdk#35869

@vsmenon
Copy link
Member Author

vsmenon commented Feb 7, 2019

From @renatoathaydes on February 6, 2019 17:43

Hm... lloks like this is the problem:

[SEVERE] build_web_compilers|ddc on test/model_test.dartdevc.module (cached):
Error compiling dartdevc module:webdart_example|test/model_test.ddc.js

Why would the test file be compiled with build_web_compilers? Probably should just skip it, after all my tests are plain Dart tests, not web tests (no browser or anything like that).

@jakemac53
Copy link
Contributor

jakemac53 commented Feb 7, 2019

Once you add build_web_compilers it will try to compile anything that looks like a web target to JS.

But, importing across top level dirs (with anything other than a package: uri) is not supported on the web.

You can manually include only your web directory by creating a build.yaml and doing something like this:

targets:
  $default:
    builders:
      build_web_compilers|entrypoint:
        generate_for:
          - web/**.dart

@renatoathaydes
Copy link

Where can I find documentation about handling these scenarios? And about this build_web_compilers|entrypoint thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants