首页 > 解决方案 > “颤振测试”在 docker 映像上失败,但在本地成功

问题描述

我的颤振项目中有几个测试文件,并且在flutter test本地运行这些文件没有任何错误消息。但是在以以下错误消息结尾的 docker 映像上运行相同的测试:

The following StateError was thrown running a test:
Bad state: No element

我不确定此错误消息的原因是项目本身还是我的问题Dockerfile

FROM ubuntu:16.04

ENV FLUTTER_VERSION="1.22.6"

RUN apt update -y
RUN apt install -y \ 
  git \ 
  wget \ 
  curl \ 
  unzip \ 
  lcov \ 
  lib32stdc++6

ENV FLUTTER_ROOT="/opt/flutter"
RUN git clone --branch $FLUTTER_VERSION --depth=1 https://github.com/flutter/flutter "${FLUTTER_ROOT}"
ENV PATH="${FLUTTER_ROOT}/bin:${PATH}"

RUN flutter config  --no-analytics
RUN flutter precache
RUN yes "y" | flutter doctor --android-licenses
RUN flutter doctor -v
ENV PATH $PATH:/flutter/bin/cache/dart-sdk/bin:/flutter/bin

WORKDIR /opt/app
COPY . .

RUN flutter pub get
RUN flutter test

标签: dockerflutterdartflutter-test

解决方案


推荐阅读